[PyQt] QSettings with normal and "bundled" apps (Colin McPhail)

David Cortesi davecortesi at gmail.com
Thu Jan 29 20:27:42 GMT 2015


> In the unbundled case, wrapping the settings value as a QBytesArray:
>   settings.setValue('b’,QBytesArray(b'\xde\xad\xbe\xef’))
> results in a simpler-looking plist file...

Sir, you are a genius. Adding this manual coercion made all
versions of the writer (native, bundled by cxfreeze, bundled by
pyinstaller) write the same plist, and all versions of the reader
happily accepted it.

In my defense, I had supposed that PyQt5 would do exactly
that coercion automatically, the way it automatically coerces
between string and QString. It does automatically coerce the
output of settings.value() back to a bytes type. But it seems
during the setValue call it does something else.

What I *think* PyQt does, based on some unrelated testing
I was doing with Nuitka, is to use "pickle" to wrap the bytes
type. But it doesn't do that, or silently fails attempting that,
in the bundled case.

No matter; problem solved. Thanks very much.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150129/60017224/attachment-0001.html>


More information about the PyQt mailing list