On Fri, 13 Jul 2012 15:49:48 +0200, Rodolfo Zitellini <xhero...@gmail.com> wrote: > On Thu, Jul 12, 2012 at 11:44 PM, Phil Thompson > <p...@riverbankcomputing.com> wrote: >> On Thu, 12 Jul 2012 21:08:11 +0200, Rodolfo Zitellini >> <xhero...@gmail.com> >> wrote: >>> Hi All, >>> I'm trying to run a pyqt software (frescobaldi, >>> http://frescobaldi.org/) in macos using macports. I have macports >>> 2.1.1 on macosx 10.7.4, xcode 4.3.2 (qt 4.8.2, pyqt 4.9.1, sip 4.13.2, >>> for completeness). >>> >>> My problem, it seems, is that object will never be null but only >>> QPyNullVariant. Eg.: >>> >>> language = QSettings().value("language", "") >>> if language: >>> #do stuff >>> else >>> #fallback >>> >>> language is never null: it is either the correct class or >>> QPyNullVariant (instead of null!), so it always tests true. >>> I'm asking this here in this list since with the old qt for mac 4.7 it >>> worked. I also tried the same software on linux, with qt 4.8.1 and >>> same pyqt/sip, and it works as is should (i.e. null and not >>> QPyNullVariant). >>> >>> I initially suspected it could be a compilation configuration option, >>> but I could not find anything. Anyone han an idea of what I can be >>> doing wrong? >> >> I don't know what you mean by null in this context, but ... >> >> http://www.riverbankcomputing.com/static/Docs/PyQt4/html/incompatibilities.html#pyqt-v4-9-2 >> >> ...may help. >> >> Phil > > Thanks Phil! > what bugs me most is that Frescobaldi on linux works perfectly, on > macos (same pyhon and lib versions) it crashes on startup: > > <PyQt4.QtCore.QPyNullVariant object at 0x10f581980> > Traceback (most recent call last): > File "frescobaldi", line 3, in <module> > import frescobaldi_app.main > File "/Users/xhero/devel/frescobaldi-git/frescobaldi_app/main.py", > line 41, in <module> > import po.setup # Setup language > File "/Users/xhero/devel/frescobaldi-git/frescobaldi_app/po/setup.py", > line 74, in <module> > setup() > File "/Users/xhero/devel/frescobaldi-git/frescobaldi_app/po/setup.py", > line 64, in setup > mo = find(language) > File "/Users/xhero/devel/frescobaldi-git/frescobaldi_app/po/__init__.py", > line 41, in find > filename = os.path.join(podir, language + ".mo") > TypeError: unsupported operand type(s) for +: 'QPyNullVariant' and 'str' > > The offending code is in setup.py, when it reads the language: > language = QSettings().value("language", "") > print language > if not language: > try: > language = locale.getdefaultlocale()[0] > except ValueError: > pass > if not language: > language = "C" > return language > > in linux, language prints None, on osx it prints QPyNullVariant. it > will then evaluate False in "if not language" and then crash when it > arrives in __init__.py. > > This used to work with qt 4.7 on osx. Just upgrading to 4.8 breaks > everything. > Any ideas?
It would suggest that there is a null QVariant stored in the settings for "language". If there was no value stored then "" would be returned. A workaround would therefore be to update or delete the settings data either manually or with a little script. Phil _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt