pyinstaller not finding external fortran executable

Heli hemla21 at gmail.com
Fri Jan 19 06:42:30 EST 2018


Dear all, 

My code consists of a graphical user interface written in PySide. This GUI will then call a FORTRAN executable. 

I run the FORTRAN executable using the following lines in my script:

curPath = os.path.dirname(os.path.realpath(__file__))
execPath = os.path.join(curPath, "myFORTRAN.out")
returnValue = subprocess.call([execPath, self.runConfig]


The script works fine and finds executable. The problem is when I use pyinstaller. I use the following command to create standalone executable that bundles my script, the external FORTRAN executable and all necessary python modules/libraries in to one standalone executable.  

pyinstaller --hidden-import=h5py.defs --hidden-import=h5py.utils --hidden-import=h5py.h5ac --hidden-import=h5pyl_proxy main_script.py --onefile

I get the following error running this standalone executable:


  File "subprocess.py", line 534, in call
  File "subprocess.py", line 856, in __init__
  File "subprocess.py", line 1464, in _execute_child
FileNotFoundError: [Errno 2] No such file or directory: 
..../myFORTRAN.out'

If I manually copy myFORTRAN.out in to the same directory as the standalone executable created by pyinstaller, then it works. 

Does anybody know how to fix this?

Thanks in Advance for your help, 








More information about the Python-list mailing list