From 22369cd1a87cd07b75d88ed60b9d5ea1509e778a Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Mon, 30 May 2022 21:38:51 -0600 Subject: [PATCH] gui_main.py: add error handling for unaccelerated AppleScript --- gui/gui_main.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gui/gui_main.py b/gui/gui_main.py index 2d5c34c23..4ffab85fb 100644 --- a/gui/gui_main.py +++ b/gui/gui_main.py @@ -1194,13 +1194,16 @@ class wx_python_gui: if answer == wx.ID_YES: output =subprocess.run( [ - "osascript", "-e", - 'tell app "System Preferences" to reveal anchor "General" of pane id "com.apple.preference.security"', - "-e", 'tell app "System Preferences" to activate', + "osascript", "-e", + 'tell app "System Preferences" to activate', + "-e", 'tell app "System Preferences" to reveal anchor "General" of pane id "com.apple.preference.security"', ], stdout=subprocess.PIPE, stderr=subprocess.PIPE ) + if output.returncode != 0: + # Some form of fallback if unaccelerated state errors out + subprocess.run(["open", "-a", "System Preferences"]) time.sleep(5) self.OnCloseFrame(None) else: