Python bindings

John (J5) Palmieri johnp at
Thu Dec 23 13:02:58 PST 2004

On Thu, 2004-12-23 at 21:12 +0100, Julien PUYDT wrote:
> Le jeudi 23 décembre 2004 à 12:05 -0500, John (J5) Palmieri a écrit :
> > I just checked and the python bindings don't seem to wrap the activation
> > methods. 
> They don't. That's precisely why I tried to call the ActivateService
> method on /org/freedesktop/DBus (which is what is done anyway). The
> problem is that that method takes two arguments:
> * a string (the service to activate) ;
> * a uint32 (the flag).
> And that int is the problem, since I have no idea how to create an
> object of that type!
> >  There are two ways, you can set the auto activation flag on
> > the message bus (dbus_message_set_auto_activation) and just call a
> > method of the service
> Not wrapped.
> >  or you can call dbus_bus_activate_service and
> > activate the service directly.
> Not wrapped.
> >   Both of those need to be wrapped.  If I can get to it over vacation I will. 
> That would be nice: I only know python since two days -- I'm not sure I
> can write wrappers already!
> > > I tried to call the ActivateService
> > > method on /org/freedesktop/DBus, but got an error message because I
> > > should have provided a second argument of type uint32 (which I don't
> > > know how to obtain) ;
> > 
> > Not sure how to do it through the dbus interface.  Check how
> > dbus_bus_activate_service does it and you might be able to do activation
> > from pure dbus calls without needing the python wrappers.
> Pure dbus is possible... once you know how to get a 'uint32' (and when I
> think this isn't even used!)...

Just send in an integer.  Wouldn't remote_object.ActivateService
("", 0); work?  You could also extract the
MessageIter from the Message and use it's append_int32 method but that
is all encapsulated for you. Post your code and I can be of more help

> > > 2) how do I send a message without waiting for a reply?
> > 
> > You would need to use the lowlevel dbus bindings (import dbus_bindings)
> > and call send_with_reply or just send on a dbus_bindings.Connection
> > object (note that send_with_reply_and_block is the function that is used
> > to send a message and wait for a reply.  send_with_reply returns a
> > PendingCall object which can be used to get a reply async.  Check the
> > file for more info assuming you are willing to wade
> > through Pyrex code which is a mixture of Python and C).
> I already had a look but found it hard to swallow. Notice that I didn't
> ask how not to block while waiting a reply. I know there won't be any
> answer, so I don't even want a PendingCall or whatever. Send the message
> and forget about it.

I gave you that.  You need to use the "send" method of the low level
bindings. Or you can alternatively use signals which are assumed to be
fire and forget.

John (J5) Palmieri
Associate Software Engineer
Desktop Group
Red Hat, Inc.

More information about the dbus mailing list