Problem to build message with python binding

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Nov 29 02:43:11 PST 2010


On Sun, 28 Nov 2010 at 00:34:25 +0800, Sun Ning wrote:
> I found for a dict output, if there is an entry whose value is a
> list, then all values in the dict will be treated as list in result
> msg.

You aren't giving dbus-python enough information for it to know what type you
want, so it has to guess (and can't get it right in complex cases). You'll need
to give it more information by giving it D-Bus-specific types, something like:

    return dbus.Dictionary({
            'myint64': dbus.Int64(42),
            'mylist': dbus.Array([1, 2, 3], signature='u'),
            'mydict': dbus.Dictionary({}, signature='us'),
        }, signature='sv')

Regards,
    Simon


More information about the dbus mailing list