Closed PySimpleGUI closed 4 weeks ago
Oh, thank you. :) And I thought there was an issue with my program haha
Yea I added one recently, cwd:getcwd(). (GetCurrentWorkingDirectory) I needed that for my cython-compiled tests. But apparently that isn't necessary with pyinstalller compiled exes. I don't understand. :)
I was looking at the differences in our code for the subprocessing, and I believe you'll be able to simply swap out your Popen for the PySimpleGUI Exec call.
I ran some tests and the result appears to be the same. Maybe I'm missing something as I'm no expert in the subprocessing module nor how you're using it. I just did some quick tests.
I should have noted that I ran into this error when trying to use Popen with the same kinds of parms you're using:
File "X:\Python\python3.9\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "X:\Python\python3.9\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 193] %1 is not a valid Win32 application
I found a discussion on SO about this error. The easy "Fix" is to set shell=True, which is what I do in the Exec calls as well.
https://stackoverflow.com/questions/25651990/oserror-winerror-193-1-is-not-a-valid-win32-application
The way I deal with this in the Exec APIs is that I have a call specifically for executing Python files. As one answer points out, the error says that the parm being passed in is not a valid Win32 application, which is true.
I never encountered that error. And I remember there WAS a reason why it is False in my program. (Needs more comments) Maybe something about the compiled executable. I'll do some tests now... Nope, no idea why. :)
I see you're using POpen... I need to check out those parameters you're using as some of them I don't have in the PySimpleGUI Exec API calls and think perhaps I should.
Thanks for showing me some additional use cases that I've not yet seen. Nicely done!