[PyKDE] How to pass UDSEntry to KIO.NetAccess.stat

Jim Bublitz jbublitz at nwinternet.com
Mon Dec 4 17:07:36 GMT 2006


On Monday 04 December 2006 05:59, jisaitua at covenco.cl wrote:
> Hi,
>
> I'm a newbie in python and pyKde and was trying to use NetAccess.stat. My
> problem is, that the UDSEntry parameter returns always empty.
>
> I tried with the following sample code:
> ------------------------------------------------
> import sys
> from kio import KIO
> from kdecore import KApplication,KURL
>
> app=KApplication(sys.argv, "KIO.NetAccess Testing")
> myURL = KURL("/usr/bin/python")
>
> if KIO.NetAccess.exists(myURL):
>         udsEntry=[]
>         if KIO.NetAccess.stat(myURL, udsEntry):
>                 #It doesn't get any UDSAtom...len (udsEntry) is always 0
>                 print "Number of UDSAtoms in UDSEntry: ", len(udsEntry)
> ------------------------------------------------
>
> Maybe what I'm doing is completely wrong, I don't know, so please help! I
> really would appreciate any hint.
>
> P.D: I'm using kubuntu 6.10 with pykde-3.15.2, pyqt-3.16, sip-4.4.5 and
> kde-3.5.5

The KIO.NetAccess.stat methods in PyKDE aren't coded correctly. The list (your 
udsEntry variable) should be a return value, not an argument. It should be:

   result, udsEntry = KIO.NetAccess.stat (myURL)

where result is bool and udsEntry is a Python list. But the error is in PyKDE, 
and if you re-code that way it still won't work until I fix PyKDE.

I'm still trying to get a snapshot together with some other fixes, but it will 
be a while - not in the next few days at any rate.

Jim




More information about the PyQt mailing list