Python 表格模块中的这个错误是什么?

What is this error in Python tabula module?

我一直收到这个错误。我正在研究 -

Mac 塞拉利昂 10.8

Python 3.6.2

表格 1.0.5

Traceback (most recent call last):
  File "/Users/Sam/Desktop/mitch test/test.py", line 22, in <module>
    tabula.convert_into(root.fileName, "_ExportedPDF-" + date_time + ".csv", output_format="csv", pages="all")
AttributeError: module 'tabula' has no attribute 'convert_into'

我的代码出错了。

tabula.convert_into(root.fileName, "_ExportedPDF-" + date_time + ".csv", output_format="csv", pages="all")

更新:

当我尝试执行 from tabula import wrapper 时出现错误:

ImportError: cannot import name 'wrapper'

更新:

根据@L 修正评论。阿尔瓦雷斯

出现以下错误:

Traceback (most recent call last):
  File "/Users/Sam/Desktop/mitch test/test.py", line 22, in <module>
    tabula.convert_into(root.fileName, "_ExportedPDF-" + date_time + ".csv", output_format="csv", pages="all")
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tabula/wrapper.py", line 140, in convert_into
    subprocess.check_output(args)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 336, in check_output
    **kwargs).stdout 
File"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['java', '-jar', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tabula/tabula-0.9.2-jar-with-dependencies.jar', '--pages', 'all', '--guess', '--format', 'CSV', '--outfile', '_ExportedPDF-Jul 26 2017.csv', '/Users/Sam/Desktop/mitch test/security_by_curr_risk_ldw.pdf']' returned non-zero exit status 1.

我怀疑你 pip install tabula 安装了一个 tabula 版本为 1.0.5 的库。这里是 the github repo。它没有 convert_into 函数

但你实际上是想安装 this tabula,其最新版本是 0.9.0

你应该 pip uninstall tabulapip3 install tabula-py

CalledProcessError: 命令'['java', '-jar', '/lib/python2.7/site-packages/tabula/tabula-1.0.1-jar-with-dependencies.jar', ' --pages', '1', '--guess',]' 返回非零退出状态 1

如果出现上述错误,则意味着您必须安装 java-jre 和 java-jdk

sudo apt-get install default-jre

sudo apt-get install default-jdk

如果以上安装成功,您可以按照这里的步骤操作 https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04