problem calling ElementTree._ElementInterface.find withPyObject_CallObject

S

sndive

I have a weid problem. If i do this:
import elementtree.ElementTree as ET
....
tree = ET.parse("whatever")
root = tree.getroot()
r = root.find('last')
print r
return root
where last is not an immediate child of root node i get back None.
However if i comment the r = root.find('last')
print r
part out and PyObject_CallObject on root from c++ space
i get

Traceback (most recent call last):
File "/var/tmp/build/x86-ezx/lib/python2.4/site-packages/elementtree/
ElementTree.py", line 329, in find
return ElementPath.find(self, path)
File "/var/tmp/build/x86-ezx/lib/python2.4/site-packages/elementtree/
ElementPath.py", line 188, in find
return _compile(path).find(element)
File "/var/tmp/build/x86-ezx/lib/python2.4/site-packages/elementtree/
ElementPath.py", line 178, in _compile
p = Path(path)
File "/var/tmp/build/x86-ezx/lib/python2.4/site-packages/elementtree/
ElementPath.py", line 70, in __init__
tokens = xpath_tokenizer(path)
AttributeError: _ElementInterface instance has no attribute 'last'

(the call to PyObject_CallObject works fine if root.find on the
requested attribute was performed first
from python space!!!)

this is with ElementTree 1.2.6 if that matters here at all
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,979
Messages
2,570,185
Members
46,728
Latest member
FernMcmull

Latest Threads

Top