Qt class as the return type in QSettings().value(...) produces SystemError

417 Views Asked by At

The following code raises SystemError: <built-in method value of PySide6.QtCore.QSettings object at 0x...> returned NULL without setting an error at the last line.

from PySide6.QtCore import QSettings
from PySide6.QtGui import QColor

s: QSettings = QSettings('StackOverflow', 'Logo')
s.value('thickness', 3.0, float)
s.value('color', QColor('#f48024'), QColor)

However, if I omit the return type and use just

s.value('color', QColor('#f48024'))

everything goes fine and returns QColor. What's wrong with QColor as a type? Actually, the error appears with every Qt class name used as a return type in QSettings.

Python 3.9.6 on Fedora, PySide6 is 6.1.2, inside a venv. With Python 3.8 on Kubuntu, however, I did not experience such a problem two days ago. I'll update the question as soon as I check the packages used there.

Update: Same with Python 3.8.10 on Kubuntu, PySide6 from 6.1.0 to 6.1.2. My memory does betray me.

0

There are 0 best solutions below