diversion: do not name dbus in the handler that guards importing it

gnome_dbus_interface_setup() imports dbus inside the try block but catches
dbus.exceptions.DBusException. If the import itself raises ImportError --
dbus-python is only installed on Linux -- the name dbus is unbound, so the
ImportError is not caught and merely evaluating the except clause raises
NameError. Catch Exception instead.
This commit is contained in:
Nick Price 2026-07-11 17:43:02 -07:00
parent 057f7533b1
commit 2cfddddd10
No known key found for this signature in database
1 changed files with 1 additions and 1 deletions

View File

@ -197,7 +197,7 @@ def gnome_dbus_interface_setup():
bus = dbus.SessionBus()
remote_object = bus.get_object("org.gnome.Shell", "/io/github/pwr_solaar/solaar")
_dbus_interface = dbus.Interface(remote_object, "io.github.pwr_solaar.solaar")
except dbus.exceptions.DBusException:
except Exception:
logger.warning(
"Solaar Gnome extension not installed - some rule capabilities inoperable",
exc_info=sys.exc_info(),