首页 > 解决方案 > Python tabula.io 错误:来自 tabula-java 的错误:未指定协议 线程“main”java.awt.AWTError 中的异常

问题描述

我正在解决我在使用基于 python 的 tabula-io 库时遇到的 pdf 解析问题。

tabula-py 版本:2.2.0 包 default-jre-headless 已安装

请帮我确定我在这里做错了什么,并提出可能的解决方案来解决这个问题?

任何帮助将一如既往地受到赞赏,始终感谢开发社区......

[tabula.io] ERROR: Error from tabula-java:
No protocol specified
Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
        at java.desktop/sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
        at java.desktop/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:102)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.desktop/sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:61)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:315)
        at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:101)
        at java.desktop/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:83)
        at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:129)
        at java.desktop/java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1181)
        at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:327)
        at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:268)
        at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:254)
        at technology.tabula.Utils.pageConvertToImage(Utils.java:285)
        at technology.tabula.detectors.NurminenDetectionAlgorithm.detect(NurminenDetectionAlgorithm.java:101)
        at technology.tabula.CommandLineApp$TableExtractor.extractTablesBasic(CommandLineApp.java:421)
        at technology.tabula.CommandLineApp$TableExtractor.extractTables(CommandLineApp.java:408)
        at technology.tabula.CommandLineApp.extractFile(CommandLineApp.java:180)
        at technology.tabula.CommandLineApp.extractFileTables(CommandLineApp.java:124)
        at technology.tabula.CommandLineApp.extractTables(CommandLineApp.java:106)
        at technology.tabula.CommandLineApp.main(CommandLineApp.java:76)


exception is Command '['java', '-Dfile.encoding=UTF8', '-jar', '/usr/local/lib/python3.6/site-packages/tabula/tabula-1.0.5-jar-with-dependencies.jar', '--pages', 'all', '--guess', '--format', 'JSON', '/tmp/1539334171190.pdf']' returned non-zero exit status 1.

标签: javapython-3.xdebiantabula-py

解决方案


推荐阅读