[PyQt] TypeError: unable to convert a QVariant of type 9 to a QMetaType of type 1024

Phil Thompson phil at riverbankcomputing.com
Mon Mar 27 13:14:28 BST 2017


On 25 Mar 2017, at 7:05 am, Zhao Lee <redstone-cold at 163.com> wrote:
> 
> 
> 
> >>> from PyQt5.QtCore import QSettings
> >>> settings = QSettings(QSettings.IniFormat, QSettings.UserScope, "iMath", "LYYDownloader2")
> >>> settings.value('list_value3',[],type=list)
> Traceback (most recent call last):
>   File "<pyshell#30>", line 1, in <module>
>     settings.value('list_value3',[],type=list)
> TypeError: unable to convert a QVariant of type 9 to a QMetaType of type 1024
> >>> settings.value('list_value3',defaultValue = [],type=list)
> Traceback (most recent call last):
>   File "<pyshell#32>", line 1, in <module>
>     settings.value('list_value3',defaultValue = [],type=list)
> TypeError: unable to convert a QVariant of type 9 to a QMetaType of type 1024
> >>>

Hopefully fixed in tonight's snapshot.

In the meantime type='QVariantList' should work.

Phil


More information about the PyQt mailing list