{"action":"closed","issue":{"url":"https://api.github.com/repos/jcushman/pdfquery/issues/7","labels_url":"https://api.github.com/repos/jcushman/pdfquery/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/jcushman/pdfquery/issues/7/comments","events_url":"https://api.github.com/repos/jcushman/pdfquery/issues/7/events","html_url":"https://github.com/jcushman/pdfquery/issues/7","id":16300109,"number":7,"title":"Problems running sample code","user":{"login":"aseeman","id":3210455,"avatar_url":"https://avatars.githubusercontent.com/u/3210455?v=3","gravatar_id":"","url":"https://api.github.com/users/aseeman","html_url":"https://github.com/aseeman","followers_url":"https://api.github.com/users/aseeman/followers","following_url":"https://api.github.com/users/aseeman/following{/other_user}","gists_url":"https://api.github.com/users/aseeman/gists{/gist_id}","starred_url":"https://api.github.com/users/aseeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aseeman/subscriptions","organizations_url":"https://api.github.com/users/aseeman/orgs","repos_url":"https://api.github.com/users/aseeman/repos","events_url":"https://api.github.com/users/aseeman/events{/privacy}","received_events_url":"https://api.github.com/users/aseeman/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2013-07-03T03:27:08Z","updated_at":"2015-12-22T01:46:48Z","closed_at":"2015-12-22T01:46:48Z","body":"Hey, I've trying to get the sample code working all day but I keep running into errors.\r\nFirst, I got tried \r\n\r\n    import pdfquery\r\n\r\n    pdf = pdfquery.PDFQuery(\"pdfs/sample.pdf\")\r\n    pdf.load()\r\n    label = pdf.pq(':contains(\"Your first name and initial\")')\r\n\r\nbut it returned\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"C:\\Python27\\lib\\site-packages\\pyquery\\pyquery.py\", line 237, in __call__\r\n    (not PY3k and isinstance(args[0], basestring) or\r\n  File \"C:\\Python27\\lib\\site-packages\\pyquery\\pyquery.py\", line 213, in __init__\r\n  File \"C:\\Python27\\lib\\site-packages\\pyquery\\pyquery.py\", line 223, in _css_to_xpath\r\n  File \"C:\\Python27\\lib\\site-packages\\cssselect\\xpath.py\", line 188, in css_to_xpath\r\n  File \"C:\\Python27\\lib\\site-packages\\cssselect\\xpath.py\", line 188, in <genexpr>\r\n  File \"C:\\Python27\\lib\\site-packages\\cssselect\\xpath.py\", line 208, in selector_to_xpath\r\n  File \"C:\\Python27\\lib\\site-packages\\cssselect\\xpath.py\", line 230, in xpath\r\n  File \"C:\\Python27\\lib\\site-packages\\cssselect\\xpath.py\", line 260, in xpath_function\r\n  File \"C:\\Python27\\lib\\site-packages\\pyquery\\cssselectpatch.py\", line 196, in xpath_contains_function\r\n    def xpath_gt_function(self, xpath, function):\r\nAttributeError: 'XPathExpr' object has no attribute 'add_post_condition'\r\n\r\nFinding that this error was with CSSSelect .8.0 I downgraded to .7.1\r\n\r\nbut then typing in \r\n    >>> import pdfquery\r\n>>> pdf = pdfquery.PDFQuery(\"C:/Users/Adam/Documents/visual studio 2012/Projects/PDFtoPythonData/PDFtoPythonData/pdfs/sample.pdf\")\r\n>>> pdf.load()\r\n>>> label = pdf.pq(':contains(\"Your first name and initial\")')\r\n>>> left_corner = float(label.attr('x0'))\r\n>>> bottom_corner = float(label.attr('y0'))\r\n>>> name = pdf.pq(':in_bbox(\"%s,%s,%s,%s,\")' % (left_corner,bottom_corner-30, left_corner+150, bottom_corner)).text()\r\n\r\nresulted in \r\nTraceback (most recent call last):\r\n  File \"<pyshell#16>\", line 1, in <module>\r\n    name = pdf.pq(':in_bbox(\"%s,%s,%s,%s,\")' % (left_corner,bottom_corner-30, left_corner+150, bottom_corner)).text()\r\n  File \"C:\\Python27\\lib\\site-packages\\pyquery\\pyquery.py\", line 241, in __call__\r\n    result = self.__class__(*args, parent=self, **kwargs)\r\n  File \"C:\\Python27\\lib\\site-packages\\pyquery\\pyquery.py\", line 216, in __init__\r\n    xpath = self._css_to_xpath(selector)\r\n  File \"C:\\Python27\\lib\\site-packages\\pyquery\\pyquery.py\", line 226, in _css_to_xpath\r\n    return self._translator.css_to_xpath(selector, prefix)\r\n  File \"C:\\Python27\\lib\\site-packages\\cssselect\\xpath.py\", line 188, in css_to_xpath\r\n    for selector in selectors)\r\n  File \"C:\\Python27\\lib\\site-packages\\cssselect\\xpath.py\", line 188, in <genexpr>\r\n    for selector in selectors)\r\n  File \"C:\\Python27\\lib\\site-packages\\cssselect\\xpath.py\", line 208, in selector_to_xpath\r\n    xpath = self.xpath(tree)\r\n  File \"C:\\Python27\\lib\\site-packages\\cssselect\\xpath.py\", line 230, in xpath\r\n    return method(parsed_selector)\r\n  File \"C:\\Python27\\lib\\site-packages\\cssselect\\xpath.py\", line 259, in xpath_function\r\n    \"The pseudo-class :%s() is unknown\" % function.name)\r\nExpressionError: The pseudo-class :in_bbox() is unknown\r\n\r\nNot sure if downgrading inadvertedly broke things."}}