Nicholas
Nicholas

Reputation: 3737

Pyinstaller - FileNotFound error

I have created a python script and converted it into a .exe file by using:

Pyinstaller –-onefile RFOutputGraphs.py

It works, however one of the jobs in the scripts is failing, despite it working perfectly when run from Python.

My error is:

      FileNotFoundError: [Errno 2] no such file or directory:
     'C:\\Users\\Nicholas\\AppData\\Local\\Temp\\_MEI30362\\currency_converter
     \\eurofxref-hist.zip'

I am guessing it is not recognising what is probably an unusual module (currencyconverter)

Is there a way of fixing this?

Thank you

Upvotes: 4

Views: 10126

Answers (1)

John Anderson
John Anderson

Reputation: 39082

You can include the zip file in the .exe created by Pyinstaller using the --add-binary option as:

Pyinstaller --add-binary <path to zip>;currency_converter --onefile RFOutputGraphs.py 

This copies the zip file from its location on your PC into the .exe file, and arranges for it to be extracted into the currency_converter folder (the location mentioned in the error message) when the .exe is run. Have a look at Using Pyinstaller.

Upvotes: 6

Related Questions