0

我尝试使用 Python 中的 Slate 库阅读 pdf。

import pdfminer
import slate
with open('sample.pdf', 'rb') as f:
    pdf_text = slate.PDF(f)
    print(pdf_text)

起初我得到了预期的输出。但之后我收到以下错误消息。

TypeError                                 Traceback (most recent call last)
<ipython-input-22-225bb30adfae> in <module>
      2 import slate
      3 with open('Aruna Chermadurai Resume Copy.pdf', 'rb') as f:
----> 4     pdf_text = slate.PDF(f)
      5     print(pdf_text)

c:\users\asus\appdata\local\programs\python\python38\lib\site-packages\slate\classes.py in __init__(self, file, password, just_text, check_extractable, char_margin, line_margin, word_margin)
     54 
     55         if PYTHON_3:
---> 56             self.doc = PDFDocument()
     57             self.parser.set_document(self.doc)
     58             self.doc.set_parser(self.parser)

TypeError: __init__() missing 1 required positional argument: 'parser'

我已经安装了 20191125 版本的 pdfminer 库和 0.5.2 版本的 slate 库。

如何解决此错误?

  1. 项目清单
4

0 回答 0