-
Notifications
You must be signed in to change notification settings - Fork 225
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
ImportError: No module named Cryptodome.Random #665
Comments
from Cryptodome.Random import get_random_bytes install pyCryptodomex to fix it |
In order to get our add-ons working correctly, we need to add some additional dependencies and their recommended packages. sudo apt-get install python-pip python-crypto build-essential -y Now lets install our Python cryptography dependency. pip install pycryptodomex To make sure our add-ons are finding our pycryptodomex module, lets add a symbolic link to the location. sudo ln -s /usr/lib/python2.7/dist-packages/Crypto /usr/lib/python2.7/dist-packages/Cryptodome |
Works. Thanks. |
Thanks. This fixed the same Netflix install problem I was having with the V18 build on a Vero 4K+. Strange they'd have this issue when they control the total environment. |
I ran into the same issue where I did install the dependency via apt-get... as per instructions of @jakermx. Unfortunately, a new issue popped up where the following module was missing "from Crypto.Util import Padding". Although I was convinced that I had installed the right module. It took me a while to figure out that Kodi uses Python2.7 and not Python3. The installed Cryptodome(x) module for 2.7 does not ship with the Padding.py module. Therefore, download it manually from https://raw.githubusercontent.com/dlitz/pycrypto/7acba5f3a6ff10f1424c309d0d34d2b713233019/lib/Crypto/Util/Padding.py into /usr/lib/python2.7/dist-packages/Crypto/Util. And test from the Python prompt whether "from Crypto.Util import Padding" works. |
Should someone here have trouble installing the Netflix plugin for KODI 18 on his QNAP HD Station running QTS 4.4.3, this might help: The following instructions assume that the HD Station’s chroot is based in the same folder as it is the case on my QNAP (which was the standard path after installing HD Station through the App Center): /share/CACHEDEV1_DATA/.qpkg/HD_Station It might be in a different folder in your case (I am running a TBS-453DX with a single 1TB SSD from WD RED SA500). During my googling sessions I’ve seen instructions and logfiles based on the premise of the HD Station folder being located for example here: /share/MD0_DATA/.qpkg/HD_Station So maybe check first, if you can cd or ls your way into the folder Now come the steps to install the Crypto package to your HD Station that took me quite some time to figure out: apt update (to update the dependencies and repositories in your system) Since first using the officially recommended command resulted the Crypto package to be installed in the wrong folder /root/.local/lib/python2.7/site-packages/Cryptodome and thus could not be found by the plugin expecting the content to be in /usr/lib/python2.7/dist-packages/Cryptodome But thanks to the helpful comments of CastagnaIT, the author of the Netflix plugin, I was able to correct that mistake and instead install a fitting cryptolibrary in the right location making things easier and cleaner. Since his first suggestion did not work for me, because the package seems to be not known on my QNAP QTS HD-Station Ubuntu subsystem I used his alternative suggestion and that worked like a charm. The alternative Crypto library got installed in the right location: and there was also a Padding.py to be found in the subfolder /Util Voilá! You should now be able to use your Netflix plugin without error messages (and without messing around with symbolic links or manually downloaded Padding.py files). |
Try this: |
I am having the same problem with windows, using pycharm IDE |
I'm submitting a ...
General infomration
Prerequisites
Description
Cannot login to netflix or use plugin
Steps to Reproduce
Expected behavior: Should ask for login credentials or show categories
Actual behavior: An error emerges (more in log) and goes to "File manager"
Context (Environment)
Installation
Operating System
Additional informatin on the environment
[latest OSMC on rpi2 with latest Kodi 18]
Debug log
2019-04-15 18:10:34.131 T:1686106848 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.ImportError'>
Error Contents: No module named Cryptodome.Random
Traceback (most recent call last):
File "/home/osmc/.kodi/addons/plugin.video.netflix/service.py", line 18, in
from resources.lib.MSLHttpRequestHandler import MSLTCPServer
File "/home/osmc/.kodi/addons/plugin.video.netflix/resources/lib/MSLHttpRequestHandler.py", line 14, in
from resources.lib.MSLv2 import MSL
File "/home/osmc/.kodi/addons/plugin.video.netflix/resources/lib/MSLv2.py", line 34, in
from MSLCrypto import MSLCrypto as MSLHandler
File "/home/osmc/.kodi/addons/plugin.video.netflix/resources/lib/MSLCrypto.py", line 8, in
from Cryptodome.Random import get_random_bytes
ImportError: No module named Cryptodome.Random
-->End of Python script error report<--
2019-04-15 18:14:02.485 T:1765798624 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.ValueError'>
Error Contents: No JSON object could be decoded
Traceback (most recent call last):
File "/home/osmc/.kodi/addons/plugin.video.netflix/addon.py", line 33, in
NAVIGATION.router(paramstring=REQUEST_PARAMS)
File "/home/osmc/.kodi/addons/plugin.video.netflix/resources/lib/utils.py", line 60, in wrapped
result = func(*args, **kwargs)
File "/home/osmc/.kodi/addons/plugin.video.netflix/resources/lib/Navigation.py", line 123, in router
options = self.before_routing_action(params=params)
File "/home/osmc/.kodi/addons/plugin.video.netflix/resources/lib/utils.py", line 60, in wrapped
result = func(*args, **kwargs)
File "/home/osmc/.kodi/addons/plugin.video.netflix/resources/lib/Navigation.py", line 867, in before_routing_action
'method': 'is_logged_in'}))
File "/home/osmc/.kodi/addons/plugin.video.netflix/resources/lib/Navigation.py", line 1054, in call_netflix_service
parsed_json = json.loads(data, object_pairs_hook=OrderedDict)
File "/usr/lib/python2.7/json/init.py", line 352, in loads
return cls(encoding=encoding, **kw).decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
-->End of Python script error report<--
2019-04-15 18:14:02.678 T:1765798624 WARNING: CPythonInvoker(3, /home/osmc/.kodi/addons/plugin.video.netflix/addon.py): the python script "/home/osmc/.kodi/addons/plugin.video.netflix/addon.py" has left several classes in memory that we couldn't clean up. The classes include: N9XBMCAddon9xbmcaddon5AddonE
2019-04-15 18:14:02.691 T:1795158752 ERROR: GetDirectory - Error getting plugin://plugin.video.netflix/
2019-04-15 18:14:02.697 T:1916167728 ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.netflix/) failed
2019-04-15 18:14:16.856 T:1533010656 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.ValueError'>
Error Contents: No JSON object could be decoded
Traceback (most recent call last):
File "/home/osmc/.kodi/addons/plugin.video.netflix/addon.py", line 33, in
NAVIGATION.router(paramstring=REQUEST_PARAMS)
File "/home/osmc/.kodi/addons/plugin.video.netflix/resources/lib/utils.py", line 60, in wrapped
result = func(*args, **kwargs)
File "/home/osmc/.kodi/addons/plugin.video.netflix/resources/lib/Navigation.py", line 115, in router
'method': 'logout'}))
File "/home/osmc/.kodi/addons/plugin.video.netflix/resources/lib/Navigation.py", line 1054, in call_netflix_service
parsed_json = json.loads(data, object_pairs_hook=OrderedDict)
File "/usr/lib/python2.7/json/init.py", line 352, in loads
return cls(encoding=encoding, **kw).decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
-->End of Python script error report<--
2019-04-15 18:14:17.168 T:1533010656 WARNING: CPythonInvoker(4, /home/osmc/.kodi/addons/plugin.video.netflix/addon.py): the python script "/home/osmc/.kodi/addons/plugin.video.netflix/addon.py" has left several classes in memory that we couldn't clean up. The classes include: N9XBMCAddon9xbmcaddon5AddonE
2019-04-15 18:14:25.455 T:1533010656 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.ValueError'>
Error Contents: No JSON object could be decoded
Traceback (most recent call last):
File "/home/osmc/.kodi/addons/plugin.video.netflix/addon.py", line 33, in
NAVIGATION.router(paramstring=REQUEST_PARAMS)
File "/home/osmc/.kodi/addons/plugin.video.netflix/resources/lib/utils.py", line 60, in wrapped
result = func(*args, **kwargs)
File "/home/osmc/.kodi/addons/plugin.video.netflix/resources/lib/Navigation.py", line 119, in router
return self.switch_account()
File "/home/osmc/.kodi/addons/plugin.video.netflix/resources/lib/Navigation.py", line 814, in switch_account
self._check_response(self.call_netflix_service({'method': 'logout'}))
File "/home/osmc/.kodi/addons/plugin.video.netflix/resources/lib/Navigation.py", line 1054, in call_netflix_service
parsed_json = json.loads(data, object_pairs_hook=OrderedDict)
File "/usr/lib/python2.7/json/init.py", line 352, in loads
return cls(encoding=encoding, **kw).decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
-->End of Python script error report<--
The text was updated successfully, but these errors were encountered: