[PyQt] SystemError raised in QSettings.value

Ales Erjavec ales.erjavec324 at gmail.com
Mon Jul 2 16:21:17 BST 2018


The `QSetings.value` can raise a:

   SystemError: <built-in method value of QSettings object at
0x103d56ee8> returned
   a result with an error set

This can happen if the stored value was a QVariantMap with complex
(PyQt_PyObject?) stored values and the query `type` parameter is not
`dict` or `"QVariantMap"`

from PyQt5.QtCore import QSettings

s = QSettings("/dev/null", QSettings.IniFormat)
s.setValue("value", {"a": ["a"]})

print(s.value("value", defaultValue="", type=str))

Tested with  PyQt5 5.9.2 and 5.11.2

More information about the PyQt mailing list