[PyQt] A dire warning message

Hans-Peter Jansen hpj at urpla.net
Thu Jul 7 15:04:29 BST 2011


On Thursday 07 July 2011, 14:00:28 Algis Kabaila wrote:
> On Thu, 7 Jul 2011 09:03:47 PM Hans-Peter Jansen wrote:
> > Dear Al,
> >
> > On Thursday 07 July 2011, 11:22:34 Algis Kabaila wrote:
> > > This bothersome warning message probably has nothing to do with
> > > PyQt. However, it does occur whenever I use PyQt.  No great harm
> > > seems to occur and the programs function normally, except for
> > > that message. Is there something wrong with my setup or should I
> > > just forget all about it?
> > >
> > > I attach a little test program "open.py". It does not do anything
> > > - and just tries to open a  file dialog after a click on the
> > > pushButton.  That produces the error message.
> > >
> > > The "program" is mainly filled with the message itself and some
> > > comments. I would think that this probably has been dealt with,
> > > but I will not know if I do not ask... so thanks again for your
> > > patience. OTH, may be other people will find this informative,
> > > too - or am the only one being subjected to this warning?
> > >
> > > #!/usr/bin/env python3.2
> > > '''
> > > open.py - a sample program to show the dire warning it generates
> > > and every other program that tries to use a file read dialog.
> > > Platform - kubuntu 11.04 "natty"
> > > Python 3.2
> > > Qt 4.7.2 (from "natty" binaries.
> > > PyQt4 4.8.4 - bound to Python 3.2 whilst compiling
> > >
> > > On opening a file dialog, I get this warning:
> > >
> > > KGlobal::locale::Warning your global KLocale is being recreated
> > > with a valid main component instead of a fake component, this
> > > usually means you tried to call i18n related functions before
> > > your main component was created. You should not do that since it
> > > most likely will not work
> > >
> > > Search on the net seems to give some grim news:
> > >
> > > <quote start>
> > > Re: VLC Hangs on Open File dialog
> > > Postby Rémi Denis-Courmont » Sat Jan 29, 2011 11:58 pm
> > > In the mean time, someone in KDE actually looked at the issue.
> > > It turns to be a longstanding known bug in the QProcess class
> > > from Qt4. That bug gets triggered by a new "feature" in KDE 4.6
> > > relative to MIME types in the Open and Save dialogs, that happens
> > > to involve the QProcess class.
> > >
> > > In the end, VLC is blaming KDE, KDE is blaming Qt, and Qt is
> > > blaming the kernel.
> > > <quote end>
> > > '''
> >
> > Hmm, at the first glance, this is a KDE problem, since KDE plugs
> > its own file dialog into Qt, but fails to properly deal with
> > locales there after due to them not being initialized correctly.
> > This is going to produce issues, if you're calling QFileDialogs and
> > expects them being localized correctly. It might be possible to
> > circumvent these issues by instancing KApplication instead of
> > QApplication (and doing the proper KDE4 setup sequence).
> >
> > Detlev is doing a nice trick in eric4: it checks, if PyKDE4 is
> > available, and uses it, otherwise it uses plain Qt4.
> >
> > How this could be related to QProcess escapes me but what do I
> > know..
> >
> > Pete
>
> Yes, I recall Detlev putting me right on other issues with PyKDE4 -
> requires putting a tick on one of the configuration boxes of eric.  I
> am using eric5 (that's the python3 version). I will install the
> newest version and look for the "box to tick" - Detlev is a very
> helpful guy!

Yes, and eric is awesome. But unfortunately, even eric (4.4.16 at least)  
using PyKDE4 code suffer from this, too. Hence I was wrong.

> The message does occur exactly the same way when the scripts are
> fired from CLI. I should try it on a gnome desktop in order to avoid
> PyKDE4.

No, it's not a PyKDE4 issue. It's triggered deep under the covers 
somewhere between KDE4 and Qt4. We will have to wait for the respective 
people to have it fixed one day.

You will get rid of it, if you deinstall kdelibs4 and all dependencies, 
but probably, it's easier to wait and live with it.

> IIRIC, PyKDE4 is not windows compatible.  And that is a 
> problem if one wants to ensure compatibility with Windows - I do not
> really care about that. Too late for me  :).

That was a red herring. See above.

Pete


More information about the PyQt mailing list