I am struggling with my implementation of subprocess when created exe with pyInstaller.
I have a program that has a gui (tkinter) where multiple buttons have their subprocess.popen(). there is a command over ssh sent to a network device which needs some time to finish.
In pyCharm this works smooth. When I create the exe with pyInstaller, I get the following error:
Exception in Tkinter callback
Traceback (most recent call last):
File "tkinter\__init__.py", line 1699, in __call__
File "gui.py" in line 197 in wrapper
File "subprocess.py", line 707, in __init__
File "subprocess.py", line 990, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified
key not found: process1
The corresponding code snipped of gui.py line 197 is:
proc = subprocess.Popen(['python', r'commands/pec_cmd.py',
str(cmd), pec_ip, '1', '0', '0', '0', '0'],
startupinfo=subprocess.STARTUPINFO(), env=os.environ,
stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
later on I store the process in a dict, which is initialized earlier with subproccesses = {}:
subprocesses['process' + str(i)] = proc
Any idea or help why I get this FileNotFoundError? When run from PyCharm it works, but as soon as the exe is created (--onedir and --onefile tried), it fails