PyXML on Ubuntu
Question: I just completed a fresh install of Ubuntu 10.10 and I'm trying to run some
scripts that use xml and xpath. I get an error from inside PyXML.

I think this is an install error. To get this installed I did the following:

    
    
    prompt> sudo apt-get install python2.6-dev   # The next line wouldn't install without this.
    prompt> sudo easy_install PyXML
    

\-------BEGIN ERROR--------- username@ubuntu:~/data/code$ MyScript.py

    
    
    Traceback (most recent call last):
      File "/home/username/data/code/app/trunk/MyScript.py", line 17, in <module>
        from xml import xpath
      File "/usr/local/lib/python2.6/dist-packages/PyXML-0.8.4-py2.6-linux-i686.egg/_xmlplus/xpath/__init__.py", line 112, in <module>
        from pyxpath import ExprParserFactory
      File "/usr/local/lib/python2.6/dist-packages/PyXML-0.8.4-py2.6-linux-i686.egg/_xmlplus/xpath/pyxpath.py", line 59, in <module>
        from xml.xpath.ParsedAbbreviatedRelativeLocationPath import ParsedAbbreviatedRelativeLocationPath
      File "/usr/local/lib/python2.6/dist-packages/PyXML-0.8.4-py2.6-linux-i686.egg/_xmlplus/xpath/ParsedAbbreviatedRelativeLocationPath.py", line 31
        as = ParsedAxisSpecifier.ParsedAxisSpecifier('descendant-or-self')
         ^
    SyntaxError: invalid syntax
    

\-------------END ERROR-------------------

I'm about at my limits with PyXML. I simply want to read an xml file and
read/write data with xpath. Is there a simpler library that will easily work
out of the box? Or any ideas on how to fix this?


Answer: Just for the record, if you really need PyXML (i.e. legacy code that you don't
have the time to port right now), just changing `as` in the two places it is
used to some other variable name will do.

Additionally, I noticed that Gentoo added the method `use_pyxml()` to PyXML
which explicitly needs to be called; so the standard library XML modules are
not used. See [here](http://www.gossamer-threads.com/lists/gentoo/dev/230817)
if that is of interest.

