Problem sending message from Python
John (J5) Palmieri
johnp at redhat.com
Mon Apr 25 07:45:03 PDT 2005
On Mon, 2005-04-25 at 15:36 +0100, Tony Houghton wrote:
> I've been patching up more bits of ROX and come across another problem
> in some Python capplets. They work OK with dbus 0.2x but not with 0.32
> or CVS checked out about a couple of days ago:
>
> rox_session = bus.get_service('net.sf.rox.Session')
> rox_settings = rox_session.get_object('/Settings',
> 'net.sf.rox.Session.Settings')
> ...
> rox_settings.SetInt(self.name, self.int_value)
>
> Traceback (most recent call last):
> File "/home/tony/Config/Font/settings.py", line 107, in set
> rox_settings.SetInt(self.name, self.int_value)
> File "/usr/local/stow/dbus//lib/python2.3/site-packages/dbus.py", line
> 235, in __call__
> reply_message = self._connection.send_with_reply_and_block(message,
> 5000)
> File "dbus_bindings.pyx", line 524, in
> dbus_bindings.Connection.send_with_reply_and_block
> dbus_bindings.DBusException: Argument 1 is specified to be of type
> "int32", but is actually of type "uint32"
>
> I'm a Python novice and didn't even realise you could do dynamic binding
> like that use of "SetInt". Cool. But I think that's beside the point
> really. I don't see how the Python program can have any control over the
> type of the argument, so is that a bug in the dbus bindings? Or is it a
> problem with the program receiving the message? If it's a bindings bug,
> is it fixed in the new bindings checked in today?
Python right now only understands int32 since it is an untyped language.
The next release will not fix this as of yet but the release after next
should. There are two ways this will happen. There will be signature
hints in which you can pass a signature to the method and it will
correctly marshal the data and there will be introspection on all
classes that support the Introspectable interface. Unfortunately I need
to get a release out now and implementing the above code could
potentially cause bugs delaying the release. The other option is for
Rox to switch to just using int32 for now if it really doesn't need the
uint. I have no idea why this worked in the 0.2x series.
--
John (J5) Palmieri
Associate Software Engineer
Desktop Group
Red Hat, Inc.
Blog: http://martianrock.com
More information about the dbus
mailing list