failure to locate elements #7

gawel opened this Issue Nov 28, 2012 · 2 comments


None yet

2 participants


Lane Stevens created an issue 2012-07-18

I have include two files. The first file is a proper subset of the second. In the first file, the p and div elements are not found. In the second file the p and div elements are correctly found.

This issue was found in using PyQuery via WebTest but it fails when using PyQuery directly. The version in use is 1.2.1.


from pyquery import PyQuery
f = open('f1','r')
s =
d = PyQuery(s)
print len(d('p')) #should be 1 for both files

Files at


initial trace, there is a slightly difference on
f2.html will cause "etree.XMLSyntaxError" by the &copy, and use lxml.html parser to parse the result, and get the right result OAO


I think this is related to issue #31, that XMLSyntaxError cause lxml use html parser, and get the right result in the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment