Auto-Py-to-EXE将python文件转换为可执行文件

所以我制作了一个脚本,从网上(通过 selenium)下载 pdf,然后将所述 pdf 表转换为 excel 文件(通过 tabula)。我想与办公室的人分享这个脚本,但我的团队没有任何 python/编程经验,所以我决定使用 Auto-Py-to-EXE 将 python 文件转换为可执行文件。然后我添加了一个文件(chromedriver)并成功下载。

对于转换,我使用 tabula 将 PDF 转换为 csv 和 xlsx 文件。(在 notebook/.py 中,转换有效)但是当我将 .py 转换为 exe 并运行可执行文件时,出现以下错误。

  File "tabulaio.py", line 80, in _run
  File "subprocess.py", line 493, in run
  File "subprocess.py", line 858, in __init__
  File "subprocess.py", line 1311, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "erc_scraper.py", line 126, in 
  File "tabulaio.py", line 322, in read_pdf
  File "tabulaio.py", line 91, in _run
tabula.errors.JavaNotFoundError: `java` command is not found from this Python process.Please ensure Java is installed and PATH is set for `java`
[24568] Failed to execute script 'erc_scraper' due to unhandled exception!

所以我尝试将我的 java 路径添加到链接后面的环境路径中。我已将 C:Program Files (x86)Javajre6bin 添加到 JAVA_HOME、JAVA 和 PATH。

但是,现在我在尝试执行 EXE 文件时收到此错误。

Error from tabula-java:
Unable to access jarfile C:Usersur7634oDesktoperc_scrapertabulatabula-1.0.4-jar-with-dependencies.jar
subprocess.CalledProcessError: Command '['java', '-Dfile.encoding=UTF8', '-jar', 'C:\Users\ur7634o\Desktop\erc_scraper\tabula\tabula-1.0.4-jar-with-dependencies.jar', '--pages', 'all', '--guess', '--format', 'JSON', 'C:\Users\ur7634o\Desktop\ERC Data\pdf\qualified_contestable_customers_20220221-11-09-36.pdf']' 
returned non-zero exit status 1.
[25240] Failed to execute script 'erc_scraper' due to unhandled exception!

有什么建议下一步该怎么做?似乎可执行文件无法读取文件?我正在考虑如何让最终用户也可以轻松地做到这一点。我只希望最终用户能够双击快捷方式来启动文件的下载和转换。

© 版权声明
THE END
喜欢就支持一下吧
点赞227赞赏 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容