Plugin fails on RHEL6.6 with SyntaxError due to old ElementTree module#4
Open
neirbowj wants to merge 1 commit intoshuque:masterfrom
neirbowj:lxml
Open
Plugin fails on RHEL6.6 with SyntaxError due to old ElementTree module#4neirbowj wants to merge 1 commit intoshuque:masterfrom neirbowj:lxml
neirbowj wants to merge 1 commit intoshuque:masterfrom
neirbowj:lxml
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.etreein place ofxml.etree.ElementTreeto retain Python 2.6 compatibility.