试图将PDF解析为文本,并且一直试图从Slate开始。
然而,就像到处张贴的基本示例一样,我得到了以下信息:
>>> import slate
>>> with open('pytest.PDF') as fp:
... doc = slate.PDF(fp)
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/slate/slate.py", line 52, in __init__
self.append(self.interpreter.process_page(page))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/slate/slate.py", line 36, in process_page
self.device.outfp.buf = ''
AttributeError: 'cStringIO.StringO' object has no attribute 'buf'有什么想法吗?
发布于 2015-11-05 17:04:32
可以通过更改发生错误的第36行来修正此问题:
self.device.outfp.truncate(0)https://stackoverflow.com/questions/32674750
复制相似问题