Elment.Tree - cElement.Tree problem
#1
I have a bizarre problem.

Well, at least for me. Here is the import:

Code:
try:
    import xml.etree.cElementTree as etree
except ImportError:
    try:
        import cElementTree as etree
    except ImportError:
        try:
            import xml.etree.ElementTree as etree


Since cElement.Tree is available it is imported as XML parser. However when I fetch XML from a server and I try to parse it I get an error. If I switch to plain Element.Tree, this error does not occur :


Code:
13:46:48 T:4533088256  NOTICE: PleXBMC -> getURL: ====== XML returned =======
13:46:48 T:4533088256  NOTICE: <?xml version="1.0" encoding="UTF-8"?>
                                            <MediaContainer size="2" allowSync="0" identifier="com.plexapp.plugins.library" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1368787250" title1="Plex Library">
                                            <Directory allowSync="1" art="/:/resources/movie-fanart.jpg" filters="1" refreshing="0" thumb="/:/resources/movie.png" key="7" type="movie" title="Movies" agent="com.plexapp.agents.imdb" scanner="Plex Movie Scanner" language="en" uuid="a055eb57-fd24-499d-a520-a1c160848d58" updatedAt="1391085646" createdAt="1391085629">
                                            <Location id="8" path="/Volumes/WD/Movies" />
                                            </Directory>
                                            <Directory allowSync="1" art="/:/resources/show-fanart.jpg" filters="1" refreshing="0" thumb="/:/resources/show.png" key="8" type="show" title="TV Shows" agent="com.plexapp.agents.thetvdb" scanner="Plex Series Scanner" language="en" uuid="626447e7-24f7-476a-983e-c1c2009a7efb" updatedAt="1391086633" createdAt="1391085723">
                                            <Location id="9" path="/Volumes/WD/TV Shows" />
                                            </Directory>
                                            </MediaContainer>
13:46:48 T:4533088256  NOTICE: PleXBMC -> getURL: ====== XML finished ======
13:46:48 T:4533088256   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.TypeError'>
                                            Error Contents: 'NoneType' object is not callable
                                            Traceback (most recent call last):
                                              File "/Users/pecinko/Library/Application Support/XBMC/addons/plugin.video.plexbmc/default.py", line 5225, in <module>
                                                amberskin()
                                              File "/Users/pecinko/Library/Application Support/XBMC/addons/plugin.video.plexbmc/default.py", line 3773, in amberskin
                                                sections = getAllSections()
                                              File "/Users/pecinko/Library/Application Support/XBMC/addons/plugin.video.plexbmc/default.py", line 627, in getAllSections
                                                tree = etree.fromstring(section_xml)
                                              File "<string>", line 84, in XML
                                            TypeError: 'NoneType' object is not callable
                                            -->End of Python script error report<--

I would like to avoid snitching to plain Element.Tree if at all possible since it is approx 3-5 times slower with larger XMLs resulting in 5-7 sec wait times on Mac Mini (minutes on RPi).

This is on OS X, both 12.3 and nightly Gotham. I'm not sure if it happens on 12.2 - will try to check later.

I'm lame python coder for sure but above seems like a valid XML to me so I guess real problem is somewhere else?
My skins:

Amber
Quartz

Reply
#2
cElementTree simple doesn't work reliably with XBMC.
There are other bugs.
See http://forum.xbmc.org/showthread.php?tid...pid1144383
No log no help.
Main page: https://github.com/Xycl
Repository: Xycl Repository Leia
Repository: Xycl Repository Matrix
Reply
#3
(2014-02-06, 15:53)Xycl Wrote: cElementTree simple doesn't work reliably with XBMC.
There are other bugs.
See http://forum.xbmc.org/showthread.php?tid...pid1144383

Well, that sucks big time.

Thanks for the heads up.
My skins:

Amber
Quartz

Reply
#4
Is there working alternative to this? I need to parse rather huge XML file and ElementTree just sits there for few seconds which is not really good experience.
Reply

Logout Mark Read Team Forum Stats Members Help
Elment.Tree - cElement.Tree problem0