It looks like you're new here. If you want to get involved, click one of these buttons!
Hi,
Maybe someone can help. I am trying to use qsettings in my python script for klayout.
I tried following to minimal example if it works in principal:
settings = pya.QSettings()
settings.setValue('test_slot', 'ABC')
test = settings.value('test_slot', 'DEF')
print(test)
Result is "DEF" (default value) so I assume it could not be read in again. Has anyone a hint what I am doing wrong?
Comments
It prints "ABC" for me ...
I'm running it as a script from the macro editor on Linux.
What's your platform, version and how to you run the script?
Background is: QSettings isn't a plain data container. It is connected to external containers such as the registry. For this it requires a properly configured application object. I assume this is missing in your case.
Matthias
Hi Matthias,
I tried it on Windows. KLayout version 0.26.4. (qt 5 python 3)
I tested it on Linux 0.26.3. (qt 5 python 3) now. I confirm it, on Linux it will prints "ABC".
Maybe a permission conflict on windows? I guess on windows the settings are stored in the registry.
I found the reason. I think I cannot write in the SystemScope.
Following works correctly now.
Print result is 'ABC'
Hi,
thanks for this update. I guess on Windows QSettings is bound to the registry. So probably you don't have permissions for the system scope.
Kind regards,
Matthias