From 788409e094d8acb033132a0519ce01a9da0e092d Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Wed, 24 Jul 2024 22:32:42 +0200 Subject: [PATCH] tools/debug-control: Handle the service not being exported This is the default case and we want to tell people how to export it when they use the script instead of having a python stack trace. Part-of: --- tools/debug-control.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/debug-control.py b/tools/debug-control.py index adbdfc088..ea2faf63a 100755 --- a/tools/debug-control.py +++ b/tools/debug-control.py @@ -17,7 +17,13 @@ def bool_to_string(value): def get_debug_control(): bus = dbus.SessionBus() - return bus.get_object(NAME, OBJECT_PATH) + try: + debug_control = bus.get_object(NAME, OBJECT_PATH) + except dbus.exceptions.DBusException: + print("The DebugControl service is not available.") + print("You may have to enable the `debug-control` flag in looking glass.") + exit(-1) + return debug_control def status(): debug_control = get_debug_control()