Working with xml files
#1
I'm trying to write an autoexec.py for my xbmc-live installed system, I need to fetch from advancedsettings.xml some infos (the hostname of the mysql server for music and videos), but my autoexec.py fails, and from the xbmc.log I can see it's failing because:

Code:
16:55:58 T:3034905456 M:1283305472   ERROR: Traceback (most recent call last):
                                              File "/home/xbmc/.xbmc/userdata/autoexec.py", line 2, in ?
                                                from xml.etree import ElementTree
                                            ImportError: No module named etree

This looks really strange to me, because, SSHed on the same machine, I can issue a python command (to enter python shell) and from there import xml.etree works flawlessly...

It looks like xbmc uses a different python interpreter from the one installed on the computer, is this right? how can I fetch those infos (and edit them) without etree? Are there other xml libs installed that I have to use?

Thank you.
Reply
#2
Quote: is this right
Yes

Quote: Are there other xml libs installed that I have to use?
It could be a good idea to check how other add-ons are processing xml.
Reply
#3
Thank you, I followed your advice and found that the plugins using xml are using elementtree importing it via:

Code:
import elementtree.ElementTree

and not the xml object I was used to use, now it all works as expected.

Thanks
Reply
#4
add <import addon="script.module.elementtree"> under requires in addon.xml and off you go.
Reply

Logout Mark Read Team Forum Stats Members Help
Working with xml files0