By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,402 Members | 1,047 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,402 IT Pros & Developers. It's quick & easy.

problem calling ElementTree._ElementInterface.find withPyObject_CallObject

P: n/a
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/", line 329, in find
return ElementPath.find(self, path)
File "/var/tmp/build/x86-ezx/lib/python2.4/site-packages/elementtree/", line 188, in find
return _compile(path).find(element)
File "/var/tmp/build/x86-ezx/lib/python2.4/site-packages/elementtree/", line 178, in _compile
p = Path(path)
File "/var/tmp/build/x86-ezx/lib/python2.4/site-packages/elementtree/", 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
Nov 15 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.