How to use 3rd party Libraries with Kodi
#1
Hi,

I'm unable to figure how to use 3rd party python libraries , for example dryscrape - https://github.com/niklasb/dryscrape/ ,

They come with a setup.py file and others , I can copy that file and include it in the root folder of my addon, then use the import statement but that doesnt work , How can i use 3rd party libraries like this?

On the wiki it says "Additional modules may be installed by simply adding the module to the root folder of your add-on.
A common way to organized third-party modules that are not part of add-on source code itself, is to add a lib directory and place an __init__.py file and other third-party modules inside it. These modules may then normally be imported using from lib import somemodule."

But lets say i want to use dryscrape , I make a lib folder and then another folder named dryscrape? also , There is an __init__.py file .

I really cant figure it out.

How can this be done ?

Thanks. Smile
Reply
#2
I'm just a beginner at this but i'll give it a shot:

yes, basically you just put the dryscape folder in resources/lib. (doesn't matter where you put it but it is recommended to put it in resources/lib)

then add code to import the classes/functions you're going to use. e.g.:
Code:
from resources.lib.dryscape.session import Session

I'm also looking for libraries that can help scrape websites. i've tried a few libraries. I've no experience with dryscape.

in my experience, the issue will come from the 3rd party library. Most of them use other libraries that kodi does not have. like lxml.
you then need to hunt down those libraries and then include them in your resources.lib. then modify the library so that they can find where you put the library that they need.
in my case it was lxml. i read around in the forum and decided that it is too complicated to make work and you will be plagued with incompatibilities.

I think it is even worse with dryscape. it looks like it also needs Qt installed.
Reply
#3
(2016-08-16, 23:13)simplythemojo Wrote: They come with a setup.py file and others , I can copy that file and include it in the root folder of my addon, then use the import statement but that doesnt work , How can i use 3rd party libraries like this?

you don't need to setup.py file (and most other stuff), only the dryscrape folder needs to be copied to the lib folder of your addon.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#4
note that dryscape has several binary dependencies, which you cannot provide on most of our platforms, e.g. webkit-server, QT
Reply

Logout Mark Read Team Forum Stats Members Help
How to use 3rd party Libraries with Kodi0