python-elementree doesn't seem to support python2.5?

Bug #81890 reported by John Carr
8
Affects Status Importance Assigned to Milestone
python2.5 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: python-elementtree

Running Feisty. The app I am trying to run (Conduit, www.conduit-project.org) isn't in the repositories but the scenario i'm sure will crop up elsewhere.

python-elementree only seems to support python 2.4, so i am running Conduit forecefully under python 2.4. Is there a reason that Element Tree isn't available under the default python interpreter?

The problems are compounded by the fact that python-gpod bindings which it also uses seem to be the other way around, "import gpod" only works under python 2.5!

Revision history for this message
Áron Sisak (asisak) wrote :

Thanks for your comment. Why do you think that python-elementree it does not support python 2.5?

The description of python-elementree states that "ElementTree is included in Python 2.5, so there is no need to install this package if you are using Python 2.5."

Changed in elementtree:
assignee: nobody → asisak
status: Unconfirmed → Needs Info
Revision history for this message
John Carr (johncarr) wrote :

Running under 2.5, i get this:-

Traceback (most recent call last):
  File "conduit/start_conduit.py", line 50, in <module>
    from conduit.MainWindow import conduit_main
  File "/home/john/Projects/conduit/conduit/MainWindow.py", line 17, in <module>
    import elementtree.ElementTree as ET
ImportError: No module named elementtree.ElementTree

However, under 2.4, all is well. Does ElementTree need to be used a certain way to make it work under 2.4 and 2.5?

Revision history for this message
John Carr (johncarr) wrote :

Easiest way to reproduce:

john@hx280:~$ python
Python 2.5 (release25-maint, Jan 15 2007, 20:25:01)
[GCC 4.1.2 20070106 (prerelease) (Ubuntu 4.1.1-21ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import elementtree
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named elementtree
>>>
john@hx280:~$ python2.4
Python 2.4.4 (#2, Dec 13 2006, 13:59:24)
[GCC 4.1.2 20061212 (prerelease) (Ubuntu 4.1.1-21ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import elementtree
>>>
john@hx280:~$

Revision history for this message
Áron Sisak (asisak) wrote :

Thank you for the bug report. There is no real python-elementtree package in Feisty, therefore I assign this bug to package python2.5

Changed in elementtree:
assignee: asisak → nobody
status: Needs Info → Confirmed
Revision history for this message
Emilio Pozuelo Monfort (pochu) wrote :

The module python ElementTree is now included in python2.5, so the package python-elementtree is now deprecated.

And about your problem, it is because the module has been renamed, as you can see here:
http://www.python.org/dev/summary/2006-04-01_2006-04-15/#elementtree-naming

The new name for it is xml.etree but it's the same module.

If you have any other question, feel free to ask it.

Thanks
Pochu

Revision history for this message
Áron Sisak (asisak) wrote :

Thank you both Emilio and John!

Changed in python2.5:
status: Confirmed → Rejected
Revision history for this message
John Carr (johncarr) wrote :

Thanks for this guys, I guess I should have looked into it a bit harder. Any opinions on the cleanest way to support 2.4 (+python-elementtree) and 2.5?

Revision history for this message
Emilio Pozuelo Monfort (pochu) wrote :

I'm not sure. Do you really need to support 2.5 and 2.4?

If you need, I have an idea. Make your package depends on python (>=2.4) and python-elementtree.

Then import the two names.

I'm not sure if this would work, but you can try it and test it :)

Good luck!
Pochu

Revision history for this message
Matthias Klose (doko) wrote : Re: [Bug 81890] Re: python-elementree doesn't seem to support python2.5?

Jc schrieb:
> Thanks for this guys, I guess I should have looked into it a bit harder.
> Any opinions on the cleanest way to support 2.4 (+python-elementtree)
> and 2.5?

please have a look at the bzr package:

try:
    try:
        # it's in this package in python2.5
        from xml.etree.cElementTree import (ElementTree, SubElement,
Element,
            XMLTreeBuilder, fromstring, tostring)
        import xml.etree as elementtree
    except ImportError:
        from cElementTree import (ElementTree, SubElement, Element,
                                  XMLTreeBuilder, fromstring, tostring)
        import elementtree
    ParseError = SyntaxError
except ImportError:
    mutter('WARNING: using slower ElementTree; consider installing
cElementTree'
           " and make sure it's on your PYTHONPATH")
    # this copy is shipped with bzr
    from util.elementtree.ElementTree import (ElementTree, SubElement,
                                              Element, XMLTreeBuilder,
                                              fromstring, tostring)
    import util.elementtree as elementtree

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.