【发布时间】:2019-08-27 07:54:34
【问题描述】:
我正在尝试使用 "slate3k" 读取 pdf 文件的文本数据。对我来说似乎很好。但是我遇到了解析错误
我一直在使用 "python3.7" 。
import slate3k
with open("/home/am-it/Desktop/PythonLearning/pdf_practice/invoice-1.pdf","rb")as file:
doc = slate3k.PDF(file)
print(doc)
以上代码的输出应该是pdf中的文本。但实际输出是
"Traceback (most recent call last):
File "/home/am-it/Desktop/PythonLearning/pdf_practice/invoslate.py", line 4, in <module>
doc = slate3k.PDF(file)
File "/home/administrator/.local/lib/python3.7/site-packages/slate3k/classes.py", line 59, in __init__
self.doc = PDFDocument()
TypeError: __init__() missing 1 required positional argument: 'parser'"
我已经传递了正确的文件对象,但仍然出现错误。所以请赐教
【问题讨论】:
-
看起来 slate3k 中可能存在错误和/或您使用的 pdfminer 版本不兼容。
-
谢谢@Iguananaut ....我卸载了pdfminer.six ...它开始工作
标签: python python-3.x slate