[Twisted-Python] question : txdbus and dbus-send

Tom Cocagne tom.cocagne at gmail.com
Tue Apr 23 00:27:24 EDT 2013

On Mon, Apr 22, 2013 at 2:25 AM, <bino at indoakses-online.com> wrote:

> Dear All
> I take
> https://github.com/cocagne/txdbus/blob/master/doc/tutorial_examples/simple_server
> and save it to /home/bino/Documents/mbink/pythons/coretac/dbus00.py
> It's work as expected when 'called' using
> https://github.com/cocagne/txdbus/blob/master/doc/tutorial_examples/simple_client
> Now I need to callable using dbus-send
> I wrote '/usr/share/dbus-1/services/org.example.service' as :
> [D-BUS Service]
> Name=org.example.MyObjPath
> Exec=/home/bino/Documents/mbink/pythons/coretac/dbus00.py

The "Name" in the org.example.services file refers to the bus name(s)
exported by the application. The file should instead read:

[D-BUS Service]

> I try to call :
> dbus-send --system --print-reply \
> --type=method_call \
> --dest='org.example.MyObjPath' '/org/example/MyObjPath' \
> org.example.MyObjPath.exampleMethod string:'MYTEXT'
> But I got error msg ... <snip>

There are several problems here. The command should be:

dbus-send --session --print-reply --type=method_call --dest='org.example'
'/MyObjPath' org.example.MyIFace.exampleMethod string:'MYTEXT'

--session means you're using the session bus instead of the system bus
(which requires a .service file in a different directory and, possibly, an
entry in /etc/dbus-1/..). The --dest flag, similar to the Name of the
.service file, refers to the bus name rather than the object. '/MyObjPath'
is the full object path exported by the server application. Lastly, the
fully-qualified method name is the interface name plus the method name
rather than the object name plus method name. It's pretty easy to confuse
the various names and paths in DBus. I did so more than once while writing
up this reply.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20130422/a8c9ee29/attachment.htm 

More information about the Twisted-Python mailing list