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

Python system paths initialization on Xbox #579

Open
tpaniaki opened this issue Oct 8, 2024 · 3 comments · May be fixed by #582
Open

Python system paths initialization on Xbox #579

tpaniaki opened this issue Oct 8, 2024 · 3 comments · May be fixed by #582

Comments

@tpaniaki
Copy link

tpaniaki commented Oct 8, 2024

Following anxdpanic/plugin.video.youtube#923, I report a failure regarding Python paths initialization on Xbox.

@horstle
Copy link
Collaborator

horstle commented Oct 13, 2024

Could you please test
script.module.inputstreamhelper-0.7.0-master-a672b6e.zip

@tpaniaki
Copy link
Author

tpaniaki commented Oct 13, 2024

I've still got path issues.

2024-10-13 19:13:13.381 T:4656    error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'FileNotFoundError'>
                                                   Error Contents: Could not find module 'kernel32' (or one of its dependencies). Try using the full path with constructor syntax.
                                                   Traceback (most recent call last):
                                                     File "Q:\Users\UserMgr0\AppData\Local\Packages\XBMCFoundation.Kodi_4n2hpmxwrvr6p\LocalState\addons\plugin.video.rtsplaytv\addon.py", line 20, in <module>
                                                       from resources.lib import rtsplaytv
                                                     File "Q:\Users\UserMgr0\AppData\Local\Packages\XBMCFoundation.Kodi_4n2hpmxwrvr6p\LocalState\addons\plugin.video.rtsplaytv\resources\lib\rtsplaytv.py", line 31, in <module>
                                                       import srgssr
                                                     File "Q:\Users\UserMgr0\AppData\Local\Packages\XBMCFoundation.Kodi_4n2hpmxwrvr6p\LocalState\addons\script.module.srgssr\lib\srgssr.py", line 39, in <module>
                                                       import inputstreamhelper
                                                     File "Q:\Users\UserMgr0\AppData\Local\Packages\XBMCFoundation.Kodi_4n2hpmxwrvr6p\LocalState\addons\script.module.inputstreamhelper\lib\inputstreamhelper\__init__.py", line 14, in <module>
                                                       from .widevine.arm import dl_extract_widevine_chromeos, extract_widevine_chromeos, install_widevine_arm
                                                     File "Q:\Users\UserMgr0\AppData\Local\Packages\XBMCFoundation.Kodi_4n2hpmxwrvr6p\LocalState\addons\script.module.inputstreamhelper\lib\inputstreamhelper\widevine\arm.py", line 13, in <module>
                                                       from .arm_lacros import cdm_from_lacros, install_widevine_arm_lacros
                                                     File "Q:\Users\UserMgr0\AppData\Local\Packages\XBMCFoundation.Kodi_4n2hpmxwrvr6p\LocalState\addons\script.module.inputstreamhelper\lib\inputstreamhelper\widevine\arm_lacros.py", line 17, in <module>
                                                       from ..unsquash import SquashFs
                                                     File "Q:\Users\UserMgr0\AppData\Local\Packages\XBMCFoundation.Kodi_4n2hpmxwrvr6p\LocalState\addons\script.module.inputstreamhelper\lib\inputstreamhelper\unsquash.py", line 19, in <module>
                                                       from ctypes import CDLL, c_void_p, c_size_t, create_string_buffer
                                                     File "S:\Program Files\WindowsApps\XBMCFoundation.Kodi_21.1.0.70_x64__4n2hpmxwrvr6p\system\python\Lib\ctypes\__init__.py", line 468, in <module>
                                                       GetLastError = windll.kernel32.GetLastError
                                                     File "S:\Program Files\WindowsApps\XBMCFoundation.Kodi_21.1.0.70_x64__4n2hpmxwrvr6p\system\python\Lib\ctypes\__init__.py", line 443, in __getattr__
                                                       dll = self._dlltype(name)
                                                     File "S:\Program Files\WindowsApps\XBMCFoundation.Kodi_21.1.0.70_x64__4n2hpmxwrvr6p\system\python\Lib\ctypes\__init__.py", line 373, in __init__
                                                       self._handle = _dlopen(self._name, mode)
                                                   FileNotFoundError: Could not find module 'kernel32' (or one of its dependencies). Try using the full path with constructor syntax.
                                                   -->End of Python script error report<--

As @MoojMidge pointed out, this seems to affect all addons using python.

Full log.

@MoojMidge
Copy link

MoojMidge commented Oct 13, 2024

this seems to affect all addons using python.

Only on some subset of Windows platforms, where presumably access to system file paths are limited due to sandboxing. Possibly related to this change in CPython python/cpython@2438cdf#diff-edff4421a88bdc56335a84a1e5a0ce0eafe5cd0c37dcb1aff03ff075bfb9b57c

It is more of a Kodi issue, but I suggested opening an issue here so that the decision to try to load the LaCrOS browser image could be managed a little better by changing

from .arm_lacros import cdm_from_lacros, install_widevine_arm_lacros

to the following:

try:
    from .arm_lacros import cdm_from_lacros, install_widevine_arm_lacros
except (ImportError, OSError):
    cdm_from_lacross = install_widevine_arm_lacros = None

and then changing

if cdm_from_lacros():
return install_widevine_arm_lacros(backup_path)

to the following:

    if cdm_from_lacros and cdm_from_lacros():
        return install_widevine_arm_lacros(backup_path)

@horstle horstle linked a pull request Nov 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants