Reputation: 683
I created an executable program using PyInstaller (Python 3.6). When you click on the .exe file it runs through the command line. This is intended as I haven't created a GUI interface yet.
My issue is if there are any errors the command line immediately closes. It's impossible to catch what the error was, which is frustrating. It's not an issue for me as developer, as I can run my program through an IDE. However, I'd like other people on my team (They are not developers or programmers) to try it out and give feedback including any errors that come up that I may have missed. They will not be able to let me know of any bugs if it shuts down that quickly.
I've tried creating a .bat file and using os.system('pause'). I couldn't get the .bat file to work when I'm not running a .py script, but an .exe instead as show here Keep Windows Console open after a Python Error. I also couldn't figure out how incorporate the .bat file when I'm using PyInstaller to create an executable from a .py file.The pause function in the os module does work, however it pauses in only where the code is located.
Ideally, I would like the user to take as long as they want to be able to read the error before closing the console and let me know what it is so I can fix what I need to. Right now, as mentioned earlier, the console closes almost instantly.
Upvotes: 2
Views: 1831
Reputation: 880
Can you please try this .BAT file? Maybe it can help.
CALL MyExeFile.exe
PAUSE
An other possible solution can be
cmd /c "MyExeFile.exe"
Please let me know, if one of the workarounds is successful.
Upvotes: 3