[PyQt] Re: Problem after upgrade to PyQt 4.6.2

Phil Thompson phil at riverbankcomputing.com
Mon Nov 23 14:25:03 GMT 2009


On Mon, 23 Nov 2009 18:08:48 +0530, Prafulla Kiran
<prafulla at tachyontech.net> wrote:
> Hi Phil,
> 
> The following piece of code throws up the error messages that Detlev has 
> mentioned. Is there something wrong that I am doing here ?
> The same piece of code works fine in PyQt 4.5.* and 4.6.1
> 
> from PyQt4 import QtCore
> 
> 
> settings_ = QtCore.QSettings("Foo", "Bar")
> 
> qString = QtCore.QString("teamtalk.im")
> 
> settings_.setValue("URL", QtCore.QVariant(qString))
> 
> This throws up:   /QVariant::save: unable to save type 256.   /in PyQt
> 4.6.2

It's a SIP code generation bug - though why it has chosen now to make
itself known I don't know.

I've just released SIP v4.9.3 - that should fix it.

> Phil Thompson wrote:
>> On Sun, 22 Nov 2009 13:58:00 +0100, detlev <detlev at die-offenbachs.de>
>> wrote:
>>   
>>> Hi,
>>>
>>> after upgrading to PyQt4 4.6.2 (from 4.6.1) I get error messages like
>>>
>>> QVariant::save: unable to save type 256.
>>> QVariant::load: unable to load type 256.
>>>
>>> What does this mean? With 4.6.1 everything was ok.
>>>     
>>
>> I don't think it has anything to do with v4.6.2.
>>
>> Although any object can be converted to and from a QVariant it is not
>> true
>> that any QVariant can be saved to and loaded from files.
>>
>> My guess is that you have written a value (at some time in the past)
that
>> can't be saved and not noticed the Qt error message. Note that QSettings
>> still writes a value in this case.
>>
>> There is a bug (fixed in tonight's snapshot) where an exception isn't
>> raised when QSettings tries to read an unreadable value, but this bug
has
>> been there since PyQt v4.5.
>>
>> For v4.7 I will add support for saving and loading objects that can be
>> pickled - but that still won't cover all objects.

Although the above isn't the correct explanation of this particular
problem, it still applies.

Phil


More information about the PyQt mailing list