Issue #30 resolved

master-runner.py logging & unicode problem

Pēteris Caune
created an issue

Logging in my webapp is set up so that log messages are written to sys.stdout. Writes to sys.stdout are picked up by ErrorCollector defined in master-runner.py and written to file. This fails with UnicodeDecodeError when I try to log unicode strings with funny characters. If ErrorCollector wasn't intercepting writes to sys.stdout, they would work fine, so I assume ErrorCollector should be able to deal with unicode.

A quick fix that worked for me was to replace in master-runner.py this:

    fp.write(complete)

with this:

    fp.write(complete.encode("utf-8"))

Comments (3)

  1. Ian Bicking repo owner

    It's not technically incorrect -- you aren't supposed to write unicode, and it's surprising its otherwise allowed. But I agree in practice -- an error log is no time to find out you didn't encode your Unicode correctly.

  2. Log in to comment