]> git.meshlink.io Git - catta/commitdiff
discover: don't show python backtrace when we cannot connect to Avahi (rhbz#585061)
authorLennart Poettering <lennart@poettering.net>
Fri, 25 Jun 2010 01:36:17 +0000 (03:36 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 25 Jun 2010 01:43:49 +0000 (03:43 +0200)
avahi-python/avahi-discover/avahi-discover.in

index 89e50779c48a7ca088e71ff96335a9215318a662..ac6b65783332b3d372f79d3951450ef2b0a1246c 100755 (executable)
@@ -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