Skip to content Skip to sidebar Skip to footer

Importing A Python Module Into Xbmc For Use Within An Addon

I'm trying to import the python module, requests, into XBMC. I downloaded the zip of the module from github and placed the requests folder into the resources/lib folder of my XBMC

Solution 1:

first, import requests when your folder is called script.module.requests won't match

second, you probably need to add the init control files to the resources and lib folders so the script can find the module (and do a import resources.lib.requests) or add the folder to your path, like this:

sys.path.append (xbmc.translatePath( os.path.join( os.getcwd(), 'resources', 'lib' ) ))

third, there's this pack: https://github.com/beenje/script.module.requests which you would then just add it to the requires section in your addon.xml file, but then, I'm also puzzled on how XBMC would find it in case the user has not the pack already installed...

Post a Comment for "Importing A Python Module Into Xbmc For Use Within An Addon"