xml - Error getting Python script to run on older version -


i had tested web based application uses python (2.7.8) scripts create dynamic content.

i parsing xml data , performing several operations on it.

one of operations requires searching type of data uses findall(xpath) function elementtree.

now place need deploy linux box has older version of python (2.6.6).

i had trouble due older elementtree not having capabilities.

i followed elementtree syntaxerror: expected path separator ([). copied elementtree 2.7.8 new box , imported there.

it imports fine different error follows:

traceback (most recent call last):   file "./filename_python.py", line 117, in <module>     ch in child.findall(xpath):   file "/usr/lib64/python2.6/xml/etree/elementpath.py", line 293, in findall     return list(iterfind(elem, path, namespaces))   file "/usr/lib64/python2.6/xml/etree/elementpath.py", line 194, in select     if "".join(e.itertext()) == value: attributeerror: itertext 

i cannot update python version on box , cannot add modules new has imported locally.

any appreciated.

thank you.

it doesn't seem me you've backported 2.7.x version library properly. take @ stack trace , see still referring library in python 2.6.x path:

/usr/lib64/python2.6/xml/etree/elementpath.py 

you consider lxml - don't need install system library. clone git repository here, , copy code projects directory.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -