[BUG] Python 3.12 - AttributeError: 'pkgutil' has no attribute 'ImpImporter'
niklas-kammertons opened this issue · 1 comments
Describe the bug
Upon initializing the trakt-scrobbler
setup with trakts init
, an AttributeError is encountered, indicating that the module 'pkgutil' has no attribute 'ImpImporter'. This issue seems to arise due to incompatibility with Python 3.12, where ImpImporter
is no longer available in the pkgutil
module. (https://docs.python.org/3.12/library/pkgutil.html#pkgutil.ImpImporter)
Desktop (please complete the following information):
- OS and Version: macOS
- Python Version: python --version Python 3.11.4
but when following install instructions somehow it gets installed in pipx with 3.12 python...
pipx list
package trakt-scrobbler 1.6.3, installed using Python 3.12.0
To Reproduce
Steps to reproduce the behavior:
- Install
trakt-scrobbler
on macOS following the official instructions (normal python env doesn't have to be Python 3.12) - Run command
trakts init
. - Encounter error during initialization.
Expected behavior
The trakt-scrobbler
should initialize without errors.
Actual behavior
An AttributeError is thrown, halting the initialization process.
Log file
Click to see log contents
trakts init
This will guide you through the setup of the scrobbler.
If you wish to quit at any point, press Ctrl+C or Cmd+C
AttributeError
module 'pkgutil' has no attribute 'ImpImporter'
at .local/pipx/venvs/trakt-scrobbler/lib/python3.12/site-packages/pkg_resources/__init__.py:2191 in <module>
2187│ dist_groups = map(find_distributions, resolved_paths)
2188│ return next(dist_groups, ())
2189│
2190│
→ 2191│ register_finder(pkgutil.ImpImporter, find_on_path)
2192│
2193│ if hasattr(importlib_machinery, 'FileFinder'):
2194│ register_finder(importlib_machinery.FileFinder, find_on_path)
2195│
Additional context
This issue appears to be specific to Python 3.12 due to the removal of the ImpImporter
attribute from the pkgutil
module. A workaround or a code update may be required for compatibility with newer Python versions. I guess the most basic workaround would be to change install instructions to make pipx not be 3.12 env.