How can I force pyinstaller to use specific .jar file when packing as exe?
I am trying to generate an executable which uses tabula-py lib. This library requires a jar file, tabula-1.0.1-jar-with-dependencies.jar, which I have in my file.py folder. These are some modifications which are at myfile.spec:
# this is for pandas lib
def get_pandas_path():
import pandas
pandas_path = pandas.__path__[0]
return pandas_path
dict_tree = Tree(get_pandas_path(), prefix='pandas', excludes=["*.pyc"])
a.datas += dict_tree
a.binaries = filter(lambda x: 'pandas' not in x[0], a.binaries)
# this is for tabula-py
jar = 'tabula-1.0.1-jar-with-dependencies'
jar_path = 'C:\\Users\\jaquedeveloper\\Documents\\freelancer\\bot\\' + jar
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
[(jar, jar_path, 'PKG')],
strip=None,
upx=True,
name='test')
Still, the error persists. When I run my code from command line, the function read_pdf(), from tabula-py, which uses the java jar, works all right, perfectly.
But when I generate the executable with pyinstaller spec command, it fails to execute this function, giving the error below:
Unable to access jarfile C:\Users\jaquedeveloper\AppData\Local\Temp_MEI58442\tabula\tabula-1.0.1-jar-with-dependencies.jar
The file is not under this folder, nor the tabula folder exists. I have the file under the same folder of the executable file.How can I force the script to use it? How can I import the jar from a specific path to the executable file, instead of using _MEI folder?
This issue was also repported here.