importlib-metadata importing
Closed this issue · 3 comments
With the recent move to Poetry a catt
installed on RPi (Raspbian) via pipx
running catt throws an expection:
Traceback (most recent call last):
File "/home/emil/.local/bin/catt", line 5, in <module>
from catt.cli import main
File "/home/emil/.local/pipx/venvs/catt/lib/python3.7/site-packages/catt/cli.py", line 6, in <module>
from importlib.metadata import version
ModuleNotFoundError: No module named 'importlib.metadata'
Injecting the required library does not improve things. The Python version is 3.7.3, and I think this might be an issue as per python-poetry/poetry#1487
Is anything below 3.9.x not supported as things stand now?
EDIT:
This is probably an issue steaming from the module renaming, ie.
try:
from importlib_metadata import version # type: ignore
except ImportError:
from importlib.metadata import version # type: ignore
Ah, ouch. We should definitely be supporting versions earlier than 3.9, does the import workaround in your comment work for you?
I haven't tried that import hack but I can try. Yep. It did.
[1] + 13092 continued vi cli.py
catt: catt --version
catt v0.12.6, Zaniest Zapper
let me check if it still needs injecting the module.
~: pipx uninstall catt && pipx install catt
uninstalled catt! ✨ 🌟 ✨
installed package catt 0.12.6, Python 3.7.3
These apps are now globally available
- catt
done! ✨ 🌟 ✨
~: catt --version
Traceback (most recent call last):
File "/home/emil/.local/bin/catt", line 5, in <module>
from catt.cli import main
File "/home/emil/.local/pipx/venvs/catt/lib/python3.7/site-packages/catt/cli.py", line 6, in <module>
from importlib.metadata import version
ModuleNotFoundError: No module named 'importlib.metadata'
~: cd .local/pipx/venvs/catt/lib/python3.7/site-packages/catt
catt: cp /tmp/cli.py . # coping already fixed file
catt: catt --version
catt v0.12.6, Zaniest Zapper.
If you want I can make a pull request, or you can fix it, I don't know if catching ImportError
is kosher for you.
Just in case since I'm not doing anything anyway: #382