[PyKDE] about dcopclients

Jim Bublitz jbublitz at nwinternet.com
Thu Dec 22 23:08:11 GMT 2005


On Thursday 22 December 2005 13:23, Orcan Ogetbil wrote:
> Hello,
> I used to use this code to create a dcop client for my superkaramba
>  widget. It used to wok fine, but after upgrading my PyKDE and PyQt it
>  stopped working,
>
> [code]
> import dcop
> import kdecore
> temp = kdecore.KApplication.kApplication()

It looks to me like you haven't instantiated KApplication yet - kApplication() 
is a static method that will return (a pointer to in C++/the object in 
Python) the KApplication object, but it doesn't instantiate it as far as I 
know.

> dcopclient = temp.dcopClient()
> dcopclient.registerAs("amarokapp")
> dcopclient.rc = dcop.DCOPRef("amarok", "player")
> [/code]
>
> It gives this error message:
>
> [message]
> $ python example.py
> Traceback (most recent call last):
>   File "example.py", line 4, in ?
>     dcopclient = temp.dcopClient()
> AttributeError: 'NoneType' object has no attribute 'dcopClient'
> [/message]

That's telling you that temp == None, which would be expected since you 
haven't instantiated it.

> What is wrong? Is the syntax changed in the last version of PyKDE?
> I have Fedora Core 4 and the following versions of PyKDE , PyQt and sip

It shouldn't have worked in the past as far as I can tell. Have a look at 
examples/example_dcopext.py (if you have the PyKDE examples installed - if 
not, they're in the tarball - get the snapshot from 
http://riverbankcomputing.co.uk/downloads/snapshots/PyKDE

Maybe the lower case 'k' is a typo/change from the previous (although I think 
you have to run KCmdLine.init to use the KApplication constructor with no 
arguments).

Jim


> PyKDE-3.11.4-0.3.20051013.fc4.kde
> PyQt-3.15.1-0.1.fc4.kde
> sip-4.3.2-0.1.fc4.kde
>
> These are rpm packages from apt.kde-redhat.org
>
> Can someone point me where I am wrong?
> Thanks!
>
> --
> Orcan Ogetbil <oogetbil at phys.psu.edu>
> Physics Department
> Penn State University
> 814-8637505
> 211 Osmond Lab
>
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde




More information about the PyQt mailing list