#17 importlib.find_module removed in Python 3.12, libray now errors on launch

Closed
opened 9 months ago by kerobaros · 4 comments

I had libray installed inside an Ubuntu container using Python 3.10.2, and it worked perfectly. However, after installing libray with pip on my Fedora system with Python 3.12.2:

Traceback (most recent call last):
  File "/home/kerobaros/.local/bin/libray", line 27, in <module>
    from libray import core
  File "/home/kerobaros/.local/share/pipx/venvs/libray/lib/python3.12/site-packages/libray/__init__.py", line 31, in <module>
    _module = loader.find_module(module_name).load_module(module_name)
              ^^^^^^^^^^^^^^^^^^
AttributeError: 'FileFinder' object has no attribute 'find_module'

It appears that find_module was removed from importlib in Python 3.12. Here is a link to the 3.12 whatsnew discussing the removal. I believe the replacement for find_module is now importlib's find_spec.

I'm three sheets to the wind or else I'd start hacking on this myself. Please let me know if I can be of any assistance in the future.

I had libray installed inside an Ubuntu container using Python 3.10.2, and it worked perfectly. However, after installing libray with pip on my Fedora system with Python 3.12.2: ``` Traceback (most recent call last): File "/home/kerobaros/.local/bin/libray", line 27, in <module> from libray import core File "/home/kerobaros/.local/share/pipx/venvs/libray/lib/python3.12/site-packages/libray/__init__.py", line 31, in <module> _module = loader.find_module(module_name).load_module(module_name) ^^^^^^^^^^^^^^^^^^ AttributeError: 'FileFinder' object has no attribute 'find_module' ``` It appears that find_module was removed from importlib in Python 3.12. [Here is a link to the 3.12 whatsnew discussing the removal.](https://docs.python.org/3/whatsnew/3.12.html#importlib) I believe the replacement for find_module is now importlib's [find_spec](https://docs.python.org/3/library/importlib.html#importlib.machinery.FileFinder.find_spec). I'm three sheets to the wind or else I'd start hacking on this myself. Please let me know if I can be of any assistance in the future.

Thank you very much for reporting, Archlinux is still on Python 3.11.7 so it's impressive that Fedora is on 3.12.2.

I'll see if I can fix it with a try/except.

I'm three sheets to the wind

Bahahah! Have a good one mate!

Tbh, I'm kind of thinking about moving away from Python if they are just going to break stuff repeatedly. This is like the 10th time something breaks for me because they're not ensuring backwards compatibility in new versions. It's a repeat of the whole Python2 vs Python3 ordeal, as if they didn't learn anything.

Thank you very much for reporting, Archlinux is still on Python 3.11.7 so it's impressive that Fedora is on 3.12.2. I'll see if I can fix it with a try/except. > I'm three sheets to the wind Bahahah! Have a good one mate! Tbh, I'm kind of thinking about moving away from Python if they are just going to break stuff repeatedly. This is like the 10th time something breaks for me because they're not ensuring backwards compatibility in new versions. It's a repeat of the whole Python2 vs Python3 ordeal, as if they didn't learn anything.
Nichlas Severinsen referenced this issue from a commit 9 months ago
Nichlas Severinsen referenced this issue from a commit 9 months ago
Nichlas Severinsen referenced this issue from a commit 9 months ago

Hmm, okay I hope it works now. Feel free to test:

pipx install git+https://notabug.org/necklace/libray
Hmm, okay I hope it works now. Feel free to test: ``` pipx install git+https://notabug.org/necklace/libray ```
kerobaros commented 9 months ago
Poster

Works On My System (tm). Or at least it launches, I haven't tried to decrypt anything yet. Thanks for the quick turnaround!

Works On My System (tm). Or at least it launches, I haven't tried to decrypt anything yet. Thanks for the quick turnaround!
Nichlas Severinsen referenced this issue from a commit 9 months ago

Of course, if you install that way you won't have any bundled keys. I recommend installing the PyPI version.

Either way, released 0.0.10 to fix this and a couple other issues, as well as more keys bundled and better game detection.

Of course, if you install that way you won't have any bundled keys. I recommend installing the PyPI version. Either way, released 0.0.10 to fix this and a couple other issues, as well as more keys bundled and better game detection.
Sign in to join this conversation.
No Milestone
No assignee
2 Participants
Loading...
Cancel
Save
There is no content yet.