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

List:       pykde
Subject:    Re: [PyQt] empty container in QSettings: TypeError
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2013-03-29 10:32:11
Message-ID: 8a7e2f19e200fbefd76857458adf0acb () localhost
[Download RAW message or body]

On Sun, 17 Mar 2013 12:39:32 +0100, Wilbert Berendsen <wbsoft@xs4all.nl>
wrote:
> Hi all,
> 
> When I store a list of strings (but happening to be empty) in
> QSettings (using QString and QVariant api 2):
> 
> e.g.:
> 
>>>> paths = []
>>>> QSettings().setValue('paths', paths)
> 
> Retrieving it yields a TypeError, instead of an empty list:
> 
>>>> QSettings().value('paths', [], 'QString')
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: unable to convert a QVariant of type 0 to a QMetaType of
> type 10
> 
> What is the most elegant way to circumvent this? cathing the TypeError
> and returning the empty list?
> 
> Best regards,
> Wilbert

I can't reproduce this. I need a short complete script that demonstrates
the problem and the version numbers you are using.

Phil
_______________________________________________
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