我已经尝试了所有可能的选项。请帮助
在python中运行表格的read_pdf()时出现以下错误。错误是
List<Error> AllInstances = (from paragraph in DocRef.LatestState
from error in paragraph.Errors
where error.Word == sourceError.Word
select error).ToList();
foreach (Error _er in AllInstances)
{
_er.Suggestions.Add(newSuggestion);
}
// At this point, if "AllInstances.Count" was 3, every "_er.Suggestions" in "AllInstances"
// will also have 3 items in it!
运行CalledProcessError: Command '['java', '-Dfile.encoding=UTF8', '-jar', 'D:\\Transfer_Folder\\WPy-3661\\python-3.6.6.amd64\\lib\\site-packages\\tabula\\tabula-1.0.3-jar-with-dependencies.jar', '--pages', 'all', '--guess', '--format', 'JSON', '--outfile', 'C:\\Users\\guptac\\AppData\\Local\\Temp\\tmpqu_wgv1o', 'C:/Users/guptac/Desktop/1409.3215.pdf']' returned non-zero exit status 1.
我得到以下信息:
tabula.environment_info()
我已经尝试保存程序文件,即我在台式机上编写了上述名为untitled0.py的代码的位置,以及试图在台式机上处理的文本文件的位置。我从Stackoverflow看到了无数的选择,例如用Java 7代替Java 8可以解决我的问题,升级Tabula软件包(我发现它已经是最新版本),并且我的Java也已更新。有人在另一篇文章的评论中说,将代码和pdf保留在我所做的同一目录中,但无济于事。上面的错误信息不断反复出现。
Python version:
3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)]
Java version:
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
tabula-py version: 1.4.0
platform: Windows-10-10.0.17763-SP0
uname:
uname_result(system='Windows', node='Guptacdt02', release='10', version='10.0.17763', machine='AMD64', processor='Intel64 Family 6 Model 158 Stepping 9, GenuineIntel')
linux_distribution: ('MSYS_NT-10.0-WOW', '2.10.0', '')
mac_ver: ('', ('', '', ''), '')
错误消息:
import tabula
df = tabula.read_pdf('C:/Users/guptac/Desktop/1409.3215.pdf',pages='all',encoding = 'utf-8',multiple_tables=True)
预期结果: 我应该能够解析多个表,或者应该说从我作为
输入提供的pdf文档中提取多个表CalledProcessError: Command '['java', '-Dfile.encoding=UTF8', '-jar', 'D:\\Transfer_Folder\\WPy-3661\\python-3.6.6.amd64\\lib\\site-packages\\tabula\\tabula-1.0.3-jar-with-dependencies.jar', '--pages', 'all', '--guess', '--format', 'JSON', '--outfile', 'C:\\Users\\guptac\\AppData\\Local\\Temp\\tmpqu_wgv1o', 'C:/Users/guptac/Desktop/1409.3215.pdf']' returned non-zero exit status 1.
更新: 同样按如下所示运行: https://github.com/chezou/tabula-py/issues/93 并没有任何好处。请参见以下错误。
tabula.read_pdf()
更新:
我下载的文档的来源是: https://arxiv.org/pdf/1409.3215.pdf
更新 我还检查了此处发布的解决方案,但不太了解他们建议的解决方案:
https://github.com/chezou/tabula-py/issues/60
更新
我放弃了对表格的希望。我使用的是
D:\Transfer_Folder\WPy-3661\python-3.6.6.amd64\Lib\site-packages>java -jar'D:\\Transfer_Folder\\WPy-3661\\python-3.6.6.amd64\\lib\\site-packages\\tabula\\tabula-1.0.3-jar-with-dependencies.jar', '--pages', 'all', '--guess', '--format', 'JSON', '--outfile', 'C:\\Users\\guptac\\AppData\\Local\\Temp\\tmpi1dv4lz7', '1409.3215.pdf'
Unrecognized option: -jar'D:\\Transfer_Folder\\WPy-3661\\python-3.6.6.amd64\\lib\\site-packages\\tabula\\tabula-1.0.3-jar-with-dependencies.jar',
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
。.好得多。
答案 0 :(得分:0)
对不起,我的答复很晚,我知道您已经使用camelot代替tabula-py,但是仅供参考,以供查找此主题的人使用。
正是Windows上引入了v1.4.0的问题。 tabula-py v1.4.1应该可以解决此问题。 https://github.com/chezou/tabula-py/releases/tag/v1.4.1