module dcop.: How to query running apps?

News123 news123 at free.fr
Sun Nov 9 20:45:23 CET 2008


Hi,

I wrote a small application connecting to an application and sending
commands to it.


Currently I'm using the methods

import dcop
client = dcop.DCOPClient()
client.registerAs(appname)
ama  = dcopclient.rc = dcop.DCOPRef("amarok", "player")

controlling the app works now fine with for example
ama.call('playPause()')

What I am missing is to have a save startup.
I'd like to know whether my dcop application is started and
ready to be connected to:

what I am doing currently is this running the shell command 'dcop'
and check it's result

def can_connect_to_amarok():
    cmd = "dcop amarok player 2> /dev/null > /dev/null ; echo $?"
    l = os.popen(cmd).readlines()
    return l[0].strip() == '0'

however I guess, that the module is capable to do the same.

Unfortunaltely I had some difficulty googling for any examples

pydoc dcop mentions that the built in function exists, but doesn't list
its parameters.


I would also be interested in getting a list of methods of a given
application/module

currently I also use the shell function
dcop application module
to get the results.

thanks in advance for any suggestions to get rid of my 'pipe call'



N













More information about the Python-list mailing list