Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CalledProcessError after bundling Python script into executable with PyInstaller #198

Closed
adammet opened this issue Dec 17, 2019 · 5 comments

Comments

@adammet
Copy link

adammet commented Dec 17, 2019

Summary of your issue

I've been using tabula-py to convert a series of pdf tables into csv files for my program to parse through and collect some data. The code works perfectly when just in the script, but if I attempt to bundle my code into an executable file using PyInstaller I get an error. Thanks for any help you can give!

Check list before submit

  • Your PDF URL: Unable to upload due to sensitivity of PDF.

  • Paste the output of import tabula; tabula.environment_info() on Python REPL:

Python version:
3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)]
Java version:
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) Client VM (build 25.131-b11, mixed mode, sharing)
tabula-py version: 1.4.3
platform: Windows-7-6.1.7601-SP1
uname:
uname_result(system='Windows', node='L17CA-D7426CPS', release='7', version='6.1.7601', machine='AMD64', processor='Intel64 Family 6 Model 94 Stepping 3, GenuineIntel')
linux_distribution: ('', '', '')
mac_ver: ('', ('', '', ''), '')

What did you do when you faced the problem?

Upon facing the problem I tried the previous solutions, namely putting the PDF in the same folder as the executable and modifying my tabula-py version to 1.3.1. Neither fix was successful.

Code:

    pdf_path = pdf_path
    output_path = output_path
    try:
        tabula.convert_into(pdf_path,pages='all', guess=False,output_format="CSV",output_path=output_path) #Try to convert the file
    except AttributeError:
        messagebox.showerror("Operation cancelled!", "In order to continue, please re-run the program and select a PDF file.")

Expected behavior:

A .csv file with the tables that were contained within the PDF.

Actual behavior:

image

Related Issues:

#60 #93 #86

@chezou
Copy link
Owner

chezou commented Dec 17, 2019

According to this thread, that should be your Pyinstaller usage problem, not tabula-py issue. pyinstaller/pyinstaller#3480

It might help to set an environment variable to use the specific jar file.
https://tabula-py.readthedocs.io/en/latest/faq.html#i-want-to-use-a-different-tabula-jar-file

@chezou chezou closed this as completed Dec 17, 2019
@MartinWeiss12
Copy link

Hey, did you ever get this working? I'm having the same issue and can't find a good solution. Thanks!

@cnmasami
Copy link

cnmasami commented Jul 29, 2022

Hey, did you ever get this working? I'm having the same issue and can't find a good solution. Thanks!

@MartinWeiss12

hey, using --add_data arg when runing Pyinstaller, here is the manual: https://pyinstaller.org/en/latest/spec-files.html#adding-data-files

pyinstaller -F MyFile.py --add-data '.\venv\Lib\site-packages\tabula\tabula-1.0.5-jar-with-dependencies.jar;tabula'

and the delimiter between 'path\xxx.jar' and 'tabula', ';' for Windows, ':' for Linux

this works for me

@neetu73
Copy link

neetu73 commented Apr 2, 2023

Hi I tried to solve this problem by using the above solution .
pyinstaller -F MyFile.py --add-data '.\venv\Lib\site-packages\tabula\tabula-1.0.5-jar-with-dependencies.jar;tabula'

but , this still seems to be throwing java not found error. Is there any other way that works?

@cnmasami
Copy link

cnmasami commented Apr 6, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants