Pyinstaller starts the entire script again once it finishes executing

13 views
Skip to first unread message

Pierre Iskandar

unread,
Jun 9, 2020, 9:21:45 AM6/9/20
to PyInstaller
Hello,

I'm having an issue where when using my pyinstaller exe, after my script finishes running through it gets restarted, I'm not seeing that behavior in PyCharm when I run the script in there.

My script is structured as follows:

1) Tkinter GUI root that is hidden
2) Tkinter popupwindow for login credentials
3) Tkinter GUI root comes back up and calls main script with threading
4) Main script does some API calls and updates a progress bar on main GUI
5) When Main script finishes, it calls root.quit() for the GUI

This works just fine in Pycharm, however with the executable, after the main script finishes, the popup window for the login credentials pops back up. If I close it something writes out in the console and it closes super fast, I tried capturing screenshots of it but I'm not quick enough to do so.

Any guidance on what I may be doing wrong or missing would be greatly appreciated.

Pierre Iskandar

unread,
Jun 9, 2020, 1:00:59 PM6/9/20
to PyInstaller
Found the issue, in my GUI file I was calling the login popup before any function call, and in my cli.py I was importing the GUI file and running the main function in there, so what was happening was on the import call, it was going in and setting the global variables (which includes that function call to fetch the pop up class).

I added the pop up class call to my GUI's main function instead and passed on the login credentials to the GUI's main button as arguments.
Reply all
Reply to author
Forward
0 new messages