Same Xpath returns different values in Centos, Ubuntu
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Note: I've opened the same request here: http://
Given this simple XML:
<root>
<outer>
<inner>
<el/>
</inner>
<inner>
<el/>
</inner>
</outer>
</root>
This code:
from lxml import etree
r = etree.parse(
print 'One: ', r.xpath('.//el[2]')
print 'Two: ', r.xpath(
Returns different output on different versions of Linux:
On Centos (python 2.7.5):
One: [<Element el at 0x25fdcf8>]
Two: [<Element el at 0x25fdcf8>]
Library versions:
Python : sys.version_
lxml.etree : (3, 6, 4, 0)
libxml used : (2, 9, 1)
libxml compiled : (2, 9, 1)
libxslt used : (1, 1, 28)
libxslt compiled : (1, 1, 28)
On RedHat Enterprise 6.6 (python 2.7.11)
One: []
Two: [<Element el at 0x7fa27198cd40>]
Library versions:
Python : sys.version_
lxml.etree : (3, 6, 0, 0)
libxml used : (2, 7, 6)
libxml compiled : (2, 7, 6)
libxslt used : (1, 1, 26)
libxslt compiled : (1, 1, 26)
On Debian and Ubuntu (python 2.7.9 and 2.7.12):
One: []
Two: [<Element el at 0x7f94ed6cf200>]
Debian library versions:
Python : sys.version_
lxml.etree : (3, 6, 4, 0)
libxml used : (2, 9, 1)
libxml compiled : (2, 9, 1)
libxslt used : (1, 1, 28)
libxslt compiled : (1, 1, 28)
Ubuntu library versions:
Python : sys.version_
lxml.etree : (3, 6, 4, 0)
libxml used : (2, 9, 3)
libxml compiled : (2, 9, 3)
libxslt used : (1, 1, 28)
libxslt compiled : (1, 1, 28)
A helpful comment from SO (http:// stackoverflow. com/questions/ 39899632/ same-xpath- returns- different- values- on-centos- ubuntu/ 39956501# 39956501) suggests the issue is with Centos' libxml (2.9.1) which does not fix https:/ /bugzilla. redhat. com/show_ bug.cgi? id=1357971 and https:/ /bugzilla. gnome.org/ show_bug. cgi?id= 695699.
I think this bug can be closed as it's related to libxml and not lxml.