2

I made a python executable using pyinstaller as pyinstaller --onefile script.py. When I run the script.exe, I get the following errors:

enter image description here

I am using tabula-py package to parse a pdf table. Script has no bugs though and is running pefect. Thanks!

Umar Aftab
  • 147
  • 4
  • 15

1 Answers1

10

This problem is apparently caused because the above mentioned jar file is not added to the dist folder structure properly.

I guess a fundamental solution would require some modifications from the side of the developers, but a possible workaround here is to use the option --add-data option to include the jar file into a folder called tabula, so something like

pyinstaller --add-data path:\to\tabula-(...).jar; tabula 

in order to make it run, or set something like

datas=[('path:\to\tabula-(...).jar', 'tabula')],

into the spec file. Made both regular builds and one-file-builds runnable for me.

failtrolol
  • 111
  • 1
  • 8
  • 1
    Great failtrolol. I had success copying tabula-1.0.2-jar-with-dependencies.jar to the script folder and entering pyinstaller --add-data tabula-1.0.2-jar-with-dependencies.jar;tabula --onefile Pdf2Excel.py – embe Sep 22 '18 at 08:24