SystemError raised in QSettings.value

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SystemError raised in QSettings.value

Ales Erjavec
Hi,

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"`

Example:
```
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
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: SystemError raised in QSettings.value

Phil Thompson-5
On 2 Jul 2018, at 4:21 pm, Ales Erjavec <[hidden email]> wrote:

>
> Hi,
>
> 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"`
>
> Example:
> ```
> 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

Should be fixed in tonight's snapshot.

Thanks,
Phil

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt