[PyQt] Logging UTF-8 when pyqtdeployed

Dave Gradwell davegradwell at yahoo.co.uk
Tue Feb 7 21:47:26 GMT 2017


If my pyqtdeploy’ed app is run from under pyqtdeploy itself (with the ‘run application’ checkbox) then it can send UTF-8 characters to the Python logging module, which end up in a log file — which is good.  It also works fine in interpreted/development mode, i.e., unpackaged.
But if I quit pyqtdeploy and immediately just double click the (now packaged) app then it fails to log UTF-8 with the error message "UnicodeEncodeError: 'ascii' codec can't encode character '\xfc' in position 66: ordinal not in range(128)”

I have the appropriate encoding hint at the top of my .py files  # -*- coding: utf-8 -*-   
(although maybe pyqtdeploy discards this anyway).
At all times, sys.getdefaultencoding() returns “utf-8”.

This is pyqtdeploy 1.3.1, SIP 4.19, PyQt 5.7.1, Python 3.5.3.
This was all statically built by   build-sysroot.py

What do I need to do to log UTF-8 when pyqtdeployed?

Thanks, Dave.


More information about the PyQt mailing list