[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] QSettings with normal and "bundled" apps (Colin McPhail)
From:       David Cortesi <davecortesi () gmail ! com>
Date:       2015-01-29 20:27:42
Message-ID: CALyzANu__7h2eSxVOrp7fH42cEO+6V8-R-Q=gg0Xfd2Ef+y7fw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> 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.

[Attachment #5 (text/html)]

<div dir="ltr"><div><div><div><div><div><div><div>&gt; In the unbundled case, \
wrapping the settings value as a QBytesArray:<br>&gt;     \
settings.setValue(&#39;b',QBytesArray(b&#39;\xde\xad\xbe\xef'))<br>&gt; results in a \
simpler-looking plist file...<br><br></div>Sir, you are a genius. Adding this manual \
coercion made all<br>versions of the writer (native, bundled by cxfreeze, bundled \
by<br>pyinstaller) write the same plist, and all versions of the reader<br>happily \
accepted it.<br></div><br></div>In my defense, I had supposed that PyQt5 would do \
exactly<br>that coercion automatically, the way it automatically \
coerces<br></div><div>between string and QString. It does automatically coerce \
the<br></div><div>output of settings.value() back to a bytes type. But it \
seems<br></div><div>during the setValue call it does something \
else.<br><br></div></div></div>What I *think* PyQt does, based on some unrelated \
testing<br></div><div>I was doing with Nuitka, is to use &quot;pickle&quot; to wrap \
the bytes<br>type. But it doesn&#39;t do that, or silently fails attempting \
that,<br>in the bundled case.<br><br></div><div>No matter; problem solved. Thanks \
very much.<br><br><br></div></div>


[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic