DBUS/HAL Manager Interface Help

Casey McGinty casey.mcginty at gmail.com
Sat Jul 26 02:13:35 CEST 2008


Can someone explain to me why this sample code does not work? I am trying to
test if a device exists.

---------------- dbus_test.py --------------------------
import dbus

bus = dbus.SystemBus()
proxy = bus.get_object( 'org.freedesktop.Hal',
'/org/freedesktop/Hal/Manager' )
manager =  dbus.Interface( proxy, 'org.freedesktop.Hal.Manager' )

some_dev = manager.GetAllDevices()[0]
print "Calling DeviceExists on '%s'" % some_dev
print manager.DeviceExists( some_dev )

------------------- output ------------------------------
$ python dbus_test.py
Calling DeviceExists on '/org/freedesktop/Hal/devices/platform_bluetooth'
Traceback (most recent call last):
  File "dbus_test.py", line 9, in <module>
    print manager.DeviceExists( some_dev )
  File "/var/lib/python-support/python2.5/dbus/proxies.py", line 140, in
__call__
    **keywords)
  File "/var/lib/python-support/python2.5/dbus/connection.py", line 607, in
call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.Hal.SyntaxError: There is a
syntax error in the invocation of the method Manager.DeviceExists
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080725/35bdb5e4/attachment.html>


More information about the Python-list mailing list