<div dir="ltr">Can someone explain to me why this sample code does not work? I am trying to test if a device exists.<br><br>---------------- dbus_test.py --------------------------<br>import dbus<br><br>bus = dbus.SystemBus()<br>
proxy = bus.get_object( 'org.freedesktop.Hal', '/org/freedesktop/Hal/Manager' )<br>manager =  dbus.Interface( proxy, 'org.freedesktop.Hal.Manager' )<br><br>some_dev = manager.GetAllDevices()[0]<br>
print "Calling DeviceExists on '%s'" % some_dev<br>print manager.DeviceExists( some_dev )<br><br>------------------- output ------------------------------<br>$ python dbus_test.py <br>Calling DeviceExists on '/org/freedesktop/Hal/devices/platform_bluetooth'<br>
Traceback (most recent call last):<br>  File "dbus_test.py", line 9, in <module><br>    print manager.DeviceExists( some_dev )<br>  File "/var/lib/python-support/python2.5/dbus/proxies.py", line 140, in __call__<br>
    **keywords)<br>  File "/var/lib/python-support/python2.5/dbus/connection.py", line 607, in call_blocking<br>    message, timeout)<br>dbus.exceptions.DBusException: org.freedesktop.Hal.SyntaxError: There is a syntax error in the invocation of the method Manager.DeviceExists<br>
<br></div>