requests ImportError
#1
A user of one of my addons is getting an ImportError from the requests library.

Code:
13:43:45  84.481079 T:2881483840   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: cannot import name utils
                                            Traceback (most recent call last):
                                              File "/storage/.kodi/addons/script.openelec.devupdate/default.py", line 517, in <module>
                                                from resources.lib import builds
                                              File "/storage/.kodi/addons/script.openelec.devupdate/resources/lib/builds.py", line 11, in <module>
                                                import requests
                                              File "/storage/.kodi/addons/script.module.requests/lib/requests/__init__.py", line 58, in <module>
                                                from . import utils
                                            ImportError: cannot import name utils

http://xbmclogs.com/show.php?id=369562

I've not been able to reproduce it. Anyone have any ideas why this would fail? Maybe a bad requests install?
Leopold's Repository: Home of LibreELEC Dev Updater ...
Reply
#2
Probably the problem is with some other addon that defines one of it's folders as a python module. Like below in addon.xml:

Code:
<extension point="xbmc.python.module" library="lib" />

And this folder lib has a utils.py file or utils folder (since it is a common name).

I had this problem this week with one of my addons that had a "module"/folder called utils. Another addon also had a utils folder and was setting it as a python module in addon.xml so my addon ended up looking in his folder instead of mine...

Not sure if this is the reason of your error but it won't hurt to check it. Ask the user to search for utils files/folders in his addon's folder.

The addon I'm talking about (that caused me troube) is probably banned here but a quick check on your log file showed me it's not installed. Which doesn't mean any other addon might not be doing the same mistake.
Reply
#3
Thanks for your reply, I'll keep it in mind. The problem turned out to be a bad install of requests. Manually removing and reinstalling it from http://mirrors.xbmc.org/addons/frodo/scr...-2.4.3.zip seems to have fixed the problem.
Leopold's Repository: Home of LibreELEC Dev Updater ...
Reply

Logout Mark Read Team Forum Stats Members Help
requests ImportError0