[PyQt] Re: Another problem with QVariant v2 API and QSettings

detlev detlev at die-offenbachs.de
Tue Dec 29 15:09:38 GMT 2009


On Dienstag, 29. Dezember 2009, Phil Thompson wrote:
> On Tue, 29 Dec 2009 14:51:56 +0100, detlev <detlev at die-offenbachs.de>
> 
> wrote:
> > Hi,
> >
> > I just discovered another problem. Enter this code in a Python console.
> >
> >>>> import sip
> >>>> sip.setapi("QString",2)
> >>>> sip.setapi("QVariant",2)
> >>>> from PyQt4.QtCore import *
> >>>> s=QSettings()
> >>>> s.setValue("k6", {1:1, 2:2, 3:3})
> >>>> s.setValue("k7", "Hello world")
> >>>> s.value("k6")
> >
> > {1: 1, 2: 2, 3: 3}
> >
> >>>> s.value("k7")
> >
> > u'Hello world'
> >
> >>>> s=None
> >
> > QVariant::save: unable to save type 256.
> >
> >>>> s
> >>>> s=QSettings()
> >>>> s.value("k6")
> >
> > QVariant::load: unable to load type 256.
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in <module>
> > SystemError: error return without exception set
> >
> >>>> s.value("k7")
> >
> > u'Hello world'
> >
> > The settings file contains these entries.
> >
> > k6=@Variant(\0\0\0\x7f\0\0\0\xePyQt_PyObject\0)
> > k7=Hello world
> 
> Works for me - it was fixed about 4 weeks ago.
> 
> Phil
> 

Sorry for the noise. I just realized I started Python interpreter with the 
wrong PyQt4 version. Thats the problem, if you have too many virtual Python 
environments around.

Detlev
-- 
Detlev Offenbach
detlev at die-offenbachs.de


More information about the PyQt mailing list