-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PyInstaller Problem] Failed to execute script on calling subprocess #2087
Comments
This is a problem with PyInstaller. I assume it all runs fine if you don't turn it into an EXE file. In the past I've not been able to turn the launcher demo programs you'll find here on the GitHub into EXE files due to PyInstaller problems. I suggest checking stackoverflow or elsewhere on the more generic problem of Subprocess calls and PyInstaller. If you strip out all of the PySimpleGUI code and just call the subprocess call from your EXE file, does that have problems? Can you try hard coding that and running a test? |
“ I assume it all runs fine if you don't turn it into an EXE file” “If you strip out all of the PySimpleGUI code and just call the subprocess call from your EXE file, does that have problems?” So did PySimpleGUI support other EXE packager, rather than pyinstaller? |
solved by change to this: p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) |
THANK YOU!!!!!!!!! I've been trying to solve this problem for some time now. I really appreciate you not only digging and finding a solution, but also coming back and posting it. Very appreciated! |
thank you very much you saved my day. |
A new set of API calls is being added this year..... the "exec SDK". These will simplify these kinds of operations for users (and for PySimpleGUI itself since it's also launching subprocesses and threads). There's a single, non-published function at the moment that can launch subprocesses and it uses similar settings: sp = Popen([command, expanded_args], shell=True, stdout=PIPE, stderr=PIPE) The overarching kinds of features it's being used for internally are for taking users to errors in their code when one is detected and for the demo programs that are self-editing or have features to edit other programs. The "Demo Browser" and "Project browser" are 2 recent examples. Almost all of my programs have an "Edit me" capability, whether it's a button or a menu item: This feature will be brought into PySimpleGUI itself as part of these new Exec APIs. |
Thank you !! this really saved me a lot of time |
This is the same call that you'll end up with by calling I'm using this API extensively now with the Demo Browser, the PySimpleHotkey that was recently released and a program being used to test the releases of PySimpleGUI. If you're already comfortable with the subprocess API calls, then you're in a good shape. I'm providing them for convenience as well as making the demos so that all levels of programmers can use them... at least that's the theory. :-) The "Edit Me" feature has been added to pretty much every new program I write that I use myself. It's made debugging so much easier as I never have to remember where I've saved the file. Glad to see PySimpleGUI being used with subprocesses either way. Post what you're making if you get a chance. I'm definitely interested. |
Type of Issues
Bug
Operating System
Windows 7
Python version
3.5
PySimpleGUI Port and Version
4.4.1
Your Experience Levels In Months or Years
Python programming experience
1
Programming experience overall
7
Have used another Python GUI Framework (tkiner, Qt, etc) previously (yes/no is fine)?
yes
You have completed these steps:
Code or partial code causing the problem
I'm new to PySimpleGUI. When I use module subprocess and packaged py into exe, it always crash like screenshot below. But when I run my py file direct in cmd, it just fine. So anyone please tell me how to fix it? thx.
Exe file crash on Windows7 when click ok:
SimpleDemoTestSubprocess.py:
package py into exe:
The text was updated successfully, but these errors were encountered: