[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] Another problem with QVariant v2 API and QSettings
From:       detlev <detlev () die-offenbachs ! de>
Date:       2009-12-29 13:51:56
Message-ID: 200912291451.56171.detlev () die-offenbachs ! de
[Download RAW message or body]

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

Regards,
Detlev
-- 
Detlev Offenbach
detlev@die-offenbachs.de
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic