[sugar] dbus python bindings and {}

Dan Williams dcbw
Sat Jul 22 23:21:28 EDT 2006


John,

Seems there's an error in the dbus python bindings?  I'm not sure I
really know what's going on here, but:

import dbus

_PRESENCE_SERVICE = "org.laptop.Presence"
_PRESENCE_DBUS_INTERFACE = "org.laptop.Presence"
_PRESENCE_OBJECT_PATH = "/org/laptop/Presence"

bus = dbus.SessionBus()
ps = dbus.Interface(bus.get_object(_PRESENCE_SERVICE,
		_PRESENCE_OBJECT_PATH), _PRESENCE_DBUS_INTERFACE)

ps.registerService({})

returns the error:

Traceback (most recent call last):
  File "foobar", line 11, in ?
    ps.registerService({})
  File "/usr/lib/python2.4/site-packages/dbus/proxies.py", line 25, in __call__
    ret = self._proxy_method (*args, **keywords)
  File "/usr/lib/python2.4/site-packages/dbus/proxies.py", line 96, in __call__
    iter.append(arg)
  File "dbus_bindings.pyx", line 1077, in dbus_bindings.MessageIter.append
  File "dbus_bindings.pyx", line 1213, in dbus_bindings.MessageIter.append_dict
IndexError: list index out of range

If you instead use {1:1} or otherwise use a non-empty dict, it works
correctly...  I thought dbus could handle empty dicts, just like it can
handle empty arrays.  Perhaps I'm wrong.

dbus-python-0.62-1

Is this maybe fixed in 0.90 bindings?

Dan



More information about the Sugar-devel mailing list