[PyKDE] KMimeType.findByPath return value

Daniel Naber daniel.naber at t-online.de
Wed Jan 1 13:48:01 GMT 2003


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.

Regards
 Daniel

-- 
http://www.danielnaber.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test3.py
Type: text/x-python
Size: 1162 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20030101/7ebe544f/test3.py


More information about the PyQt mailing list