[PyQt] "TypeError: unable to convert a QVariant back to a Python object"

David Cortesi davecortesi at gmail.com
Wed Feb 5 18:43:12 GMT 2014


Mac OS X 10.9.1; PyQt5.2; Qt5.2; app bundled by cx_freeze.
Running under python from the command line, no problem.
Running as an OS X app bundle, it terminates with the subject error on this
statement:

> old_hash = settings.value(u'old_hash')

The value being read from a Settings object was previously written thus:

> settings.setValue(u'old_hash', <a bytes object of length 20> )

Running under a debugger I verify that what is written is type bytes,
len=20, and that's what's read back -- under the debugger.

Preceding the failing statement the code has successfully executed reading
two different character string values from the same Settings. So it is the
byte-string that has a problem in conversion.

What might cause a problem converting a QVariant from the Settings into a
Python bytestring? Could there be some Sip module that didn't get bundled,
perhaps? Or something in the environment?

Any suggestions welcome...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140205/27ebb8f4/attachment.html>


More information about the PyQt mailing list