pandas Python tabula 模块中的这个错误是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45340256/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is this error in Python tabula module?
提问by sgerbhctim
I keep getting this error. I am working on -
我不断收到此错误。我正在努力——
Mac Sierra 10.8
Mac 塞拉利昂 10.8
Python 3.6.2
蟒蛇 3.6.2
tabula 1.0.5
表格 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'
This is my code that is giving me an error.
这是我的代码,它给了我一个错误。
tabula.convert_into(root.fileName, "_ExportedPDF-" + date_time + ".csv", output_format="csv", pages="all")
UPDATE:
更新:
When I try to do from tabula import wrapper
I get th error:
当我尝试这样做时,from tabula import wrapper
出现错误:
ImportError: cannot import name 'wrapper'
UPDATE:
更新:
Fixed comment as per @L. Alvarez
根据@L 修复评论。阿尔瓦雷斯
Getting following error:
得到以下错误:
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.
回答by Luis Alvarez
I suspect you did pip install tabula
, which installed a tabula
library that has a version 1.0.5. Here's the github repo. It does not have a convert_into function
我怀疑你pip install tabula
安装了tabula
一个版本为 1.0.5的库。这是github 仓库。它没有 convert_into 函数
But you actually meant to install this tabula, whose last version is 0.9.0
但你实际上是想安装这个 tabula,它的最新版本是 0.9.0
You should pip uninstall tabula
and pip3 install tabula-py
你应该pip uninstall tabula
和pip3 install tabula-py
回答by Shinto Joseph
CalledProcessError: Command '['java', '-jar', '/lib/python2.7/site-packages/tabula/tabula-1.0.1-jar-with-dependencies.jar', '--pages', '1', '--guess',]' returned non-zero exit status 1
CalledProcessError:命令'['java','-jar','/lib/python2.7/site-packages/tabula/tabula-1.0.1-jar-with-dependencies.jar','--pages',' 1', '--guess',]' 返回非零退出状态 1
If you are getting above error then it means you have to install java-jre and java-jdk
如果您遇到上述错误,则意味着您必须安装 java-jre 和 java-jdk
sudo apt-get install default-jre
sudo apt-get install default-jdk
you can follow the steps here if the above installation dosent work https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04
如果上述安装不起作用,您可以按照此处的步骤操作 https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04