Please use Python 3.7. Python 3.7 has several improvements on this area.
* When PEP 538 or 540 is used, default error handler for stdio is surrogateescape * You can sys.stdout.reconfigure(errors='surrogateescape') For Python 3.6, I think best way to allow arbitrary bytes on stdout is using `PYTHONIOENCODING=utf-8:surrogateescape` environment variable. Regards, -- https://mail.python.org/mailman/listinfo/python-list