Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin fails on RHEL6.6 with SyntaxError due to old ElementTree module #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

neirbowj
Copy link

@neirbowj neirbowj commented May 8, 2016

The version of ElementTree that ships with Python 2.6 only has support for "path/path" style XPath syntax, and cannot handle paths of the form "path/path[attr='val']/path", and will crash with a traceback similar to:

Traceback (most recent call last):
File "", line 1, in
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementTree.py", line 355, in findall
return ElementPath.findall(self, path)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementPath.py", line 198, in findall
return _compile(path).findall(element)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementPath.py", line 176, in _compile
p = Path(path)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementPath.py", line 93, in init
"expected path separator (%s)" % (op or tag)
SyntaxError: expected path separator ([)

This patch uses lxml.etree in place of xml.etree.ElementTree to retain Python 2.6 compatibility.

The version of ElementTree that ships with Python 2.6 only has
support for "path/path" style XPath syntax, and cannot handle paths
of the form "path/path[attr='val']/path", and will crash with a traceback similar to:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementTree.py", line 355, in findall
    return ElementPath.findall(self, path)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementPath.py", line 198, in findall
    return _compile(path).findall(element)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementPath.py", line 176, in _compile
    p = Path(path)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementPath.py", line 93, in __init__
    "expected path separator (%s)" % (op or tag)
SyntaxError: expected path separator ([)

For example, RHEL6 ships with Python 2.6, and lxml 2.2.3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant