From: Lennart Poettering Date: Fri, 25 Jun 2010 01:36:17 +0000 (+0200) Subject: discover: don't show python backtrace when we cannot connect to Avahi (rhbz#585061) X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=da6e5ed59ff0994ebf41b2d46a0e1ff40719d699;p=catta discover: don't show python backtrace when we cannot connect to Avahi (rhbz#585061) --- diff --git a/avahi-python/avahi-discover/avahi-discover.in b/avahi-python/avahi-discover/avahi-discover.in index 89e5077..ac6b657 100755 --- a/avahi-python/avahi-discover/avahi-discover.in +++ b/avahi-python/avahi-discover/avahi-discover.in @@ -233,7 +233,6 @@ class Main_window: return myiter def new(self): - print "A new main_window has been created" self.treemodel=gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) self.tree_view.set_model(self.treemodel) @@ -253,8 +252,12 @@ class Main_window: self.zc_types = {} self.services_browsed = {} - self.bus = dbus.SystemBus() - self.server = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER) + try: + self.bus = dbus.SystemBus() + self.server = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER) + except Exception, e: + print "Failed to connect to Avahi Server (Is it running?): %s" % e + sys.exit(1) if self.domain is None: # Explicitly browse .local