From 0b855c452f421ec47a01d3d756b5de82e9ff40f1 Mon Sep 17 00:00:00 2001 From: Supercam19 <79729769+supercam19@users.noreply.github.com> Date: Sat, 23 Mar 2024 21:24:48 -0400 Subject: [PATCH] Update main.py --- main.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/main.py b/main.py index 25649f0..23fd117 100644 --- a/main.py +++ b/main.py @@ -27,7 +27,7 @@ def __init__(self): self.title("GameMonitor") # self.resizable(False, False) self.protocol("WM_DELETE_WINDOW", self.withdraw) - self.iconbitmap("icon.ico") + if os.path.isfile("icon.ico"): self.iconbitmap("icon.ico") self.visible = True self.toplevels = [] @@ -303,16 +303,19 @@ def main(open_window): if __name__ == "__main__": - os.chdir(os.path.realpath(os.path.dirname(sys.argv[0]))) - check_files() + try: + os.chdir(os.path.realpath(os.path.dirname(sys.argv[0]))) + check_files() - default_monitor = 0 - show_on_startup = False if "--startup" in sys.argv else True + default_monitor = 0 + show_on_startup = False if "--startup" in sys.argv else True - for i, arg in enumerate(sys.argv): - show_on_startup = False if arg == '--startup' else True - if arg == '--launch-game' and len(sys.argv) > i + 1: - launch_game(sys.argv[i + 1]) + for i, arg in enumerate(sys.argv): + show_on_startup = False if arg == '--startup' else True + if arg == '--launch-game' and len(sys.argv) > i + 1: + launch_game(sys.argv[i + 1]) - main(show_on_startup) + main(show_on_startup) + except Exception as e: + popup("Error", f"An error occurred. If you believe this to be a bug, please submit an issue at github.com/supercam19/GameMonitor/issues with the error message:\n\n{e}")