Python non-variant is passed as an argument

Arigead captain.deadly at gmail.com
Thu Mar 25 08:16:37 PDT 2010


Hello all,
    I'm calling a navit dbus method which returns an object 'o':

object = nav.callback_attr_new("DestinationSet", "destination")

I then have to pass the return from this method on to another method
which takes a String and a variant 'sv':

navnav.add_attr("callback", object)

now this won't work because:

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod:
Method "add_attr" with signature "so" on interface "(null)" doesn't exist

Which is fair enough. I knew that the method took a variant but then I'd
read a sentence:

If a non-variant is passed as an argument but introspection indicates
that a variant is expected, it'll automatically be wrapped in a variant.

in the documentation [1]. Is this documentation correct? I'd assumed
that the python DBus would be doing introspection. I'll go and try to
work out how you cast the 'o' object into a variant in Python. Never
used that mechanism.

If anybody can suggest a solution I'd be very grateful. Mean time off
for a search.

[1]
http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.html#container-types


More information about the dbus mailing list