首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >获取NotImplementedError文件使用python pdftables从pdf中获取表数据

获取NotImplementedError文件使用python pdftables从pdf中获取表数据
EN

Stack Overflow用户
提问于 2017-08-14 17:52:13
回答 1查看 153关注 0票数 1

我正在使用Python pdftables从pdf中获取表数据,并按照git中的说明进行操作。

https://github.com/drj11/pdftables

但当我运行代码时

代码语言:javascript
复制
filepath = 'tests.pdf'
fileobj = open(filepath,'rb')
from pdftables.pdf_document import PDFDocument
doc = PDFDocument.from_fileobj(fileobj)

我得到这样的错误

代码语言:javascript
复制
       File "<stdin>", line 1, in <module>
       File "pdftables/pdf_document.py", line 53, in from_fileobj
       raise NotImplementedError

有人能帮我解决这个问题吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-08-14 17:55:29

如果您查看实现from_fileobj函数的file,您可以看到以下注释:

代码语言:javascript
复制
# TODO(pwaller): For now, put fh into a temporary file and call
# .from_path. Future: when we have a working stream input function for
# poppler, use that.

如果我理解正确的话,您应该使用from_path函数,因为from_fileobj还没有实现。使用当前代码很容易做到这一点:

代码语言:javascript
复制
filepath = 'tests.pdf'
from pdftables.pdf_document import PDFDocument
doc = PDFDocument.from_path(filepath)
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45671865

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档