I have a python script running on a python installation with lxml. How could I import the lxml to use it in a xbmc plugin?
Thanks
kimx
Junior Member Posts: 33 Joined: Feb 2008 Reputation: 0 |
2009-10-20 17:18
Post: #1
|
| find quote |
kimx
Junior Member Posts: 33 Joined: Feb 2008 Reputation: 0 |
2009-10-24 18:32
Post: #2
Please help me with this. I'm getting crazy...
Thanks |
| find quote |
rwparris2
Team-XBMC Python Developer Posts: 1,341 Joined: Jan 2008 Reputation: 2 Location: US |
2009-10-24 19:03
Post: #3
elementtree uses the same syntax and will be a billion times easier to distribute.
If you don't want to use elementtree... you'll have to distribute and install setuptools in your addon for all three, see http://pypi.python.org/pypi/setuptools for how to install in xbmc's python, then easy_install lxml to xbmc's python. It will also require users to already have libxslt & whatever other prerequisites lxml has installed. Basically, use elementtree instead. Always read the XBMC online-manual, FAQ and search and search the forum before posting. For troubleshooting and bug reporting please read how to submit a proper bug report. If you're interested in writing addons for xbmc, read docs and how-to for plugins and scripts ||| http://code.google.com/p/xbmc-addons/ |
| find quote |
Temhil
Skilled Python Coder Joined: Apr 2008 Reputation: 1 Location: Canada |
2009-10-24 22:12
Post: #4
Yes, same advice than rwparris2, give a try to ET, it is a very lib and you just need to provide it with your script. I gave you an example on how to use it on your previous post when you were asking which XML parser were available.
![]() _____________________________ Repositories Installer: select and install unofficial repositories / TAC.TV: watch videos on TAC.TV Installer Passion-XBMC: Download and Install Add-ons (pre-Dharma only) ![]() |
| find quote |
Dan Dare
http://www.xbmc4xbox.org Joined: Sep 2004 Reputation: 146 |
2009-10-25 13:05
Post: #5
@kimx
One solution is to include the package source as part as your plugin and then add the path with code like: PHP Code: LIB_DIR = xbmc.translatePath( os.path.join( os.getcwd(), 'resources', 'lib' ) )and then you can use an import statement. See some of the plugins plugins in my signature, they include things like BeautifulSoup or simpljason. An alternative is to use xml.dom to parse XMLs, see XBMC Xbox Trac Changelog or XBMC Zone Installer. Video plugins: Microsoft Channel 9 Videos | GameSpot | Eurogamer TV | GameTrailers | Games On Net | OpenSubtitles | Sublight Program plugins: Notepad |
| find quote |
kimx
Junior Member Posts: 33 Joined: Feb 2008 Reputation: 0 |
2009-10-25 14:02
Post: #6
Thank you for the answers, but the problem is not how to import, but which files I need to import the lib. In my script I use the etree element from lxml. In a normal python install I use this statement to import it:
Code: from lxml import etreeThanks in advance |
| find quote |
Dan Dare
http://www.xbmc4xbox.org Joined: Sep 2004 Reputation: 146 |
2009-10-25 16:05
Post: #7
You could download the source for lxml (http://pypi.python.org/pypi/lxml/) and pick the contents of the src folder, but somehow I have a feeling they won't work without compiling them for a particular platform... I would try to rewrite the logic you have using the other suggested alternatives...
Video plugins: Microsoft Channel 9 Videos | GameSpot | Eurogamer TV | GameTrailers | Games On Net | OpenSubtitles | Sublight Program plugins: Notepad |
| find quote |
queeup
Fan Joined: Feb 2009 Reputation: 15 |
2009-10-25 18:02
Post: #8
yes it wont work without compiling. It's depends Os and Python version also. For exmple if you use lxml with your XBMC plugin you should add lxml for all platforms separately (Linux,win32,Os X) and python version must be 2.4. This is huge for 1 plugin. Its approximately 6mb
![]() One more thing, for example you have windows and your python version 2.6 and you developing plugins in this computer. You need lxml for windows and python version for 2.6 but when you release plugin you need lxml for all platforms and for python 2.4. |
| find quote |
Dan Dare
http://www.xbmc4xbox.org Joined: Sep 2004 Reputation: 146 |
2009-10-25 18:12
Post: #9
I'd say - it would make sense to create a Trac request to include the appropriate lxml with Python with XBMC, but given that XBMC Team is concentrated on other tasks now, I don't see that happening soon. While there are other libraries already available with XBMC Python (xml.dom) or out there that could to the same task, the only reason I would against re-writing away from lxml is what, convenience?!
Video plugins: Microsoft Channel 9 Videos | GameSpot | Eurogamer TV | GameTrailers | Games On Net | OpenSubtitles | Sublight Program plugins: Notepad |
| find quote |
queeup
Fan Joined: Feb 2009 Reputation: 15 |
2009-10-25 18:32
Post: #10
I think this is the easiest way to do it. http://trac.xbmc.org/ticket/7246
|
| find quote |

![[Image: passionxbmc_signature.png]](http://jahnrik.free.fr/passionxbmc_signature.png)
![[Image: project_thin_badge.gif]](http://www.ohloh.net/p/passion-xbmc/widgets/project_thin_badge.gif)


Search
Help