Trouble getting my first dbus app working

John (J5) Palmieri johnp at redhat.com
Thu Apr 19 11:04:07 PDT 2007


On Wed, 2007-04-18 at 23:01 +0100, Alex Bennee wrote:

> signal sender=:1.3 -> dest=(null destination)
> path=/org/gnome/GnomeVFS/Daemon; interface=org.gnome.GnomeVFS.Daemon;
> member=VolumeMountedSignal
>    struct {
>       int32 22
>       int32 1
>       int32 4
>       int32 12
>       string "cdda:///dev/hdc"
>       string ""
>       string "Audio Disc"
>       string "gnome-dev-cdrom"
>       boolean true
>       boolean false
>       boolean true
>       string "/dev/hdc"
>       int32 5632
>       string "/org/freedesktop/Hal/devices/volume_part_1_size_570390528"
>       string ""
>    }


> def GnomeVFSMountEvent(udi):
>     print 'Device with udi %s was mounted?' % (udi)

> Exception exceptions.TypeError: 'not all arguments converted during
> string formatting' in
> 'dbus_bindings._GIL_safe_cmessage_function_handler' ignored


you are expecting a string but the signal sends you a struct.  When the
GnomeVFSMountEvent callback is run inside of
dbus_bindings._GIL_safe_cmessage_function_handler you get a type error
because not all elements in the struct (or tuple in python) can be
converted to a string.

try this in a python shell

a = (22, 1, 4, 12, "cdda:///dev/hdc", "", "Audio Disk",
"gnome-dev-cdrom", True, False, True, "/dev/hdc", 5632,
"/org/freedesktop/Hal/devices/volume_part_1_size_570390528", "")

print str(a)        # works
print "%s" % a      # breaks
print "%s" % str(a) # works

-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list