Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency on older "future" module breaks python 3.12 compatibility #239

Closed
craftyguy opened this issue May 30, 2024 · 6 comments
Closed

Comments

@craftyguy
Copy link

Describe the problem

This addon fails to run on with Python 3.12 because future 0.18.x uses imp, which was removed in Python 3.12. future 1.0 fixes this, see: PythonCharmers/python-future@a6222d2

    <import addon="script.module.future" version="0.18.2+matrix.1" />

Platform and Kodi version

Alpine Linux 3.20, Kodi 21.0

Link to Debug Log

2024-05-30 01:01:19.668 T:26624   error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'ModuleNotFoundError'>
                                                   Error Contents: No module named 'imp'
                                                   Traceback (most recent call last):
                                                     File "/var/lib/kodi/.kodi/addons/script.xbmcbackup/default.py", line 4, in <module>
                                                       from resources.lib.backup import XbmcBackup
                                                     File "/var/lib/kodi/.kodi/addons/script.xbmcbackup/resources/lib/backup.py", line 10, in <module>
                                                       from . vfs import XBMCFileSystem, DropboxFileSystem, ZipFileSystem
                                                     File "/var/lib/kodi/.kodi/addons/script.xbmcbackup/resources/lib/vfs.py", line 10, in <module>
                                                       from . authorizers import DropboxAuthorizer
                                                     File "/var/lib/kodi/.kodi/addons/script.xbmcbackup/resources/lib/authorizers.py", line 5, in <module>
                                                       import resources.lib.tinyurl as tinyurl
                                                     File "/var/lib/kodi/.kodi/addons/script.xbmcbackup/resources/lib/tinyurl.py", line 3, in <module>
                                                       from future.moves.urllib.request import urlopen
                                                     File "/var/lib/kodi/.kodi/addons/script.module.future/lib/future/moves/__init__.py", line 5, in <module>
                                                       from future.standard_library import import_top_level_modules
                                                     File "/var/lib/kodi/.kodi/addons/script.module.future/lib/future/standard_library/__init__.py", line 65, in <module>
                                                       import imp
                                                   ModuleNotFoundError: No module named 'imp'
                                                   -->End of Python script error report<--
@craftyguy craftyguy added the bug label May 30, 2024
@robweber
Copy link
Owner

I'll admit I'm not super familiar with how the local OS version of Python interacts with what Kodi is expecting. I generally use Windows (where it's bundled) or a Kodi specialized build like LibreElec. Looking at Kodi's build files it seems that it's expecting Python 3.11 for Omega.

@craftyguy
Copy link
Author

craftyguy commented May 30, 2024

Hey thanks for taking a look at this. Yeah I'm not entirely sure either... it seems(?) that kodi is using some bundled future module, the host OS has future-1.0.0 installed but in the output above the backup addon is clearly using something older (since it's trying to pull in imp). I just noticed that if go into kodi and list addon dependencies, it shows this, which is stuck at 0.18.23: https://kodi.tv/addons/omega/script.module.future/

I have no clue who packages(?) that for kodi, it's not in the list of official addons. If you changed your import to bump the version, would kodi fetch a newer version? (I also don't know how dependency resolution stuff in kodi works...)

Looking at Kodi's build files it seems that it's expecting Python 3.11 for Omega.

This also seems kinda strange since Omega advertised python 3.12 support 🙃

@craftyguy
Copy link
Author

FYI I went ahead and reported this to Kodi. Even if the actual problem doesn't lie in Kodi, maybe they can clarify how the old future module is being pulled in so this can be reported to the appropriate place.

xbmc/xbmc#25284

@craftyguy
Copy link
Author

Should be fixed by xbmc/repo-scripts#2615, IIUC. Does this addon need an update once that patch is merged to use the newer future version too?

@robweber
Copy link
Owner

robweber commented Jun 1, 2024

Took a look at the PRs involved. The way Kodi works is that it will pull in the most recent version of an addon, so if the futures addon is required (looks like TinyURL uses it) then when it's updated in the main repo it should get downloaded locally to your system. We can leave this open if you want to confirm once it's merged in the addon repo.

@craftyguy
Copy link
Author

@robweber this addon is now working as expected since the patch in repo-scripts landed 🎉

Thank you so much for the support, and the great addon :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants