On 01-Jan-03 Daniel Naber wrote: > On Tuesday 31 December 2002 07:12, Jim Bublitz wrote: >> name() returns a QString, so
>> print self.mimetype.latin1() >> should print the "appication/x-shellscript" and you should be >> able >> to use the value of self.mimetype.latin1() as a Python string. > Yes, that works but now there's another problem, see below. One > of the problems was, I think, that findByPath() never returns > None, even if you ask for a file that doesn't exist. It seems > instead you get some undefined result. But this is a problem > with the KDE API, which never returns 0 (that's what the KDE > documentation says). > Anyway, I think I've now built a small test case which crashes. > I've attached it, see the comment marked with "***". Make sure > that the filename in self.url really exists. I get "KCrash: > crashing...." but the crash dialog doesn't appear so I don't > have a backtrace. Actually it doesn't always crash, but at > least the problem that the returned name().latin1() contains > random characters appears each time. KServiceTypeProfile.preferredService takes a QString as its first argument, so you should use "mimetype" instead of "mimestr". That took care of the crash for me, but I got an odd value for offer.name(). I was using an older value of PyKDE which didn't use findByPath, so that may have been my problem. Let me know if that fixes your problem. Jim _______________________________________________ PyKDE mailing list [EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
