Reading signal from org.freedesktop.DBus

Nexu nexu.jin at
Wed Jun 28 16:50:55 PDT 2006


I have been trying to read the signals on the session bus from
org.freedesktop.DBus in Python. Without much succes. I have used this
code below trying to archieve it. This works when catching signaling
from other applications. But it just doesn't work for org.fdo.DBus
signals. But dbus-monitor does confirm the signals are being send on the
session bus.

So can anyone tell me where i went wrong with the code here?

session_bus = dbus.SessionBus()

   dbus_proxy = session_bus.get_object('org.freedesktop.DBus', '/')
   dbus_iface = dbus.Interface(dbus_proxy, 'org.freedesktop.DBus')

   print 'FATAL ERROR: Could not initialize DBus service'

dbus_iface.connect_to_signal('NameLost', watch_lost_cb)
dbus_iface.connect_to_signal('NameAcquired', watch_new_cb)

def watch_lost_cb(arg0):
    print '>> lost     : %r' % arg0

def watch_new_cb(arg0):
    print '>> acquired : %r' % arg0

More information about the dbus mailing list