From 04dd18bed921579ac12faab4a32ed2eb6ae6ade0 Mon Sep 17 00:00:00 2001 From: Tom Van Braeckel Date: Fri, 19 Dec 2014 11:52:22 +0100 Subject: [PATCH] wicd-curses: catch unhandled exception when automatically starting the wicd daemon fails --- curses/wicd-curses.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/curses/wicd-curses.py b/curses/wicd-curses.py index 0e36f44..8d2a254 100755 --- a/curses/wicd-curses.py +++ b/curses/wicd-curses.py @@ -1247,14 +1247,19 @@ def setup_dbus(force=True): except DBusException: print >> sys.stderr, \ _("Can't connect to the daemon, trying to start it automatically...") - bus = dbusmanager.get_bus() - dbus_ifaces = dbusmanager.get_dbus_ifaces() - daemon = dbus_ifaces['daemon'] - wireless = dbus_ifaces['wireless'] - wired = dbus_ifaces['wired'] + + try: + bus = dbusmanager.get_bus() + dbus_ifaces = dbusmanager.get_dbus_ifaces() + daemon = dbus_ifaces['daemon'] + wireless = dbus_ifaces['wireless'] + wired = dbus_ifaces['wired'] + except DBusException: + print >> sys.stderr, \ + _("Can't automatically start the daemon, this error is fatal...") if not daemon: - print 'Error connecting to wicd via D-Bus. ' \ + print 'Error connecting to wicd via D-Bus. ' \ 'Please make sure the wicd service is running.' sys.exit(3)