471,310 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

problem calling ElementTree._ElementInterface.find withPyObject_CallObject

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
Nov 15 '07 #1
0 1374

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by dayzman | last post: by
4 posts views Thread by Matthew Thorley | last post: by
1 post views Thread by mirandacascade | last post: by
reply views Thread by Chris McDonough | last post: by
reply views Thread by Greg Aumann | last post: by
2 posts views Thread by mirandacascade | last post: by
1 post views Thread by Mike Slinn | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.