Reading signal from org.freedesktop.DBus

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


Hello,

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?

<CODE>
session_bus = dbus.SessionBus()

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

except:
   print 'FATAL ERROR: Could not initialize DBus service'
   sys.exit(10)

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
</CODE>



More information about the dbus mailing list