[PyKDE] Cannot use KUniqueApplication with dcop

Luka Renko (Lure) lure at kubuntu.org
Wed Oct 4 20:16:45 BST 2006


On Thu, 28 Sep 2006 01:25:24, JIm Bublitz wrote:
> On Wednesday 23 August 2006 14:58, Sebastian Kügler wrote:
> > I'm trying to make a KUniqueApplication accessible via dcop, but I'm
> > getting the following error:
> >
> > dcop-testapp: ERROR: Communication problem with dcop-testapp, it probably
> > crashed.
> 
> I found some time to look at this a little more. Your short sample app will 
> "work" if you comment out the attach() call. You can also convert 
> PyKDE/examples/example_dcopexport.py to KUniqueApplication (modify the 
import 
> statement and the KApplication ctor call), and it will "work" from kdcop.

This is true. This is in line with dcop specification [1] which says:

KUniqueApplication automatically registers itself to DCOP. If you are using 
KUniqueApplication you should not attach or register yourself, this is 
already done. The appId is by definition equal to kapp->name(). You can 
retrieve the registered DCOP client by calling kapp->dcopClient().


> I say "work" because I ran into some other problems I didn't try to resolve, 
> and I'm not sure if they're bugs or normal operation. The first is that 
> executing your sample app creates two processes (pids), and two entires in 
> kdcop (one with a pid, one without). That doesn't seem to be a big deal.

The entry without pid is registered by KUniqueApplication itself, while the 
pid entry is created by registerAs() call (in sample application), which is 
actually not needed (see [1]) if KUniqueApplication is used.

> The other problem is that selecting "quit" via kdcop doesn't terminate the 
> application when KUniqueApplication is used, but it just may be necessary to 
> add some other code to accomplish that - I didn't try anything else. I'm not 
> sure how KDE is written in that respect.

The problem is that dcop interface created by KUniqueApplication itself does 
not work at all. I have removed both attach() and registerAs() in order to 
keep only interface created by KUniqueApplication. If you run "dcop <name>" 
from command line, it will just hang. Also the error reported by Sebastian 
("Communication problem with <name>, it probably crashed.") is still seen on 
any startup of the application. I suspect this is due to the fact that 
KUniqueApplication uses dcop interface to prevent multiple instances of the 
application to run. Good thing is that at least it prevents multiple 
instances.

Regards,
Luka

[1] http://developer.kde.org/documentation/other/dcop.html




More information about the PyQt mailing list