Error: No module importlib
#1
I'm working on an addon for retrieving streams from a website.
I've tested the addon on a Raspberry P (OpenElec 5)i with no problems.
After testing the addon on Kodi on an Android device I get the error "No module importlib" on the import importlib statement.

Anybody know why I get the error?
What are the differences between these devices and do we need to consider anything when developing addons?
Reply
#2
Have you installed by zip or via copying?

If you use zip, kodi will look up the dependencies (addon.xml) and pull these from the repo
If you copy it, you will have to install the dependencies by yourself

And as far as I know android is on an older python version (I think 2.6) so you can't use the newest fancy commands of anything newer
Reply
#3
I've installed by zip. As far as I know importlib should be standard in python. I've replaced the code with __import__ but haven't been able to test it because I've bumped on another error. Something about syntax error on a "with" statement.

Do you know hat python version Android is using? I didn't know each OS can have a different python version. I thought it was Kodi version dependent.
Reply
#4
All official builds have Python 2.6 - people usually use these builds (on Linux 2.7 is much more common instead, as the maintainer usually links against the system's Python). importlib is new in 2.7.
Reply
#5
Windows is officially 2.7.6
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#6
From http://forum.kodi.tv/showthread.php?tid=...pid1814641:
Quote:fyi: Windows uses 2.7.3 and is shipped by XBMC/KODI.
Linux uses 2. whatever installed on the system
Android/ios/osx use 2.6.x

Good to know that different python environments are used.
Now I can try to make my addon compatible with 2.6.x for Android OR any ETA python will be upgraded to 2.7.x for Android?
Reply
#7
I solved this problem by using the following try/except:

Code:
try:
    from importlib import import_module
except ImportError:
    from .importlib import import_module

and downloaded the importlib module and added to my project.
Quote:# Compatibility module to bring importlib to Python 2.6
# This is a local copy of https://pypi.python.org/pypi/importlib code
# which in turn is a direct copy / trivial backport of Python 2.7 code.
Reply
#8
note that we bumped python to 2.7 in krypton for all platforms.
Reply

Logout Mark Read Team Forum Stats Members Help
Error: No module importlib0