-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
I'd like to print an attribute, but I'm getting an error:
$ astpath '//Name/@id'
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/astpath/search.py", line 44, in find_in_ast
linenos = query(
File "/usr/local/lib/python3.9/site-packages/astpath/search.py", line 12, in lxml_query
return element.xpath(expression)
AttributeError: 'lxml.etree._ElementUnicodeResult' object has no attribute 'xpath'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/astpath", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/astpath/cli.py", line 37, in main
search(
File "/usr/local/lib/python3.9/site-packages/astpath/search.py", line 149, in search
file_matches = find_in_ast(
File "/usr/local/lib/python3.9/site-packages/astpath/search.py", line 49, in find_in_ast
raise AttributeError(
AttributeError: Element has no ancestor with line number.Maybe if it's an ElementUnicodeResult we should just return instead of recursing into element.expath(expression)? Thanks for your work on this project!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels