我刚刚在我的机器上安装了 pdfquery,我正在尝试从他们的站点运行该示例
import pdfquery
pdf = pdfquery.PDFQuery("examples/sample.pdf")
pdf.load()
label = pdf.pq(':contains("Your first name and initial")')
left_corner = float(label.attr('x0'))
bottom_corner = float(label.attr('y0'))
name = pdf.pq(':in_bbox("%s, %s, %s, %s")' % (left_corner, bottom_corner-30, left_corner+150, bottom_corner)).text()
print name
问题是我收到此错误
Traceback (most recent call last):
File "testePdfQuery.py", line 1, in <module>
import pdfquery
File "/home/ubuntu/Downloads/pdfquery-0.1.3/pdfquery/__init__.py", line 1, in <module>
from .pdfquery import PDFQuery
File "/home/ubuntu/Downloads/pdfquery-0.1.3/pdfquery/pdfquery.py", line 23, in <module>
cssselect.Function._xpath_in_bbox = _xpath_in_bbox
AttributeError: 'module' object has no attribute 'Function'
有什么想法可以解决这个问题并运行示例吗?提前致谢。