Replace non-printable characters in files too.

This commit is contained in:
Vgr E.Barry 2015-03-08 10:08:12 -04:00
parent a1ef3beca2
commit 3857954d9e

View File

@ -38,7 +38,7 @@ def logger(file, write=True, display=True):
if display: if display:
print(timestamp + output, file=utf8stdout) print(timestamp + output, file=utf8stdout)
if write and file is not None: if write and file is not None:
with open(file, "a") as f: with open(file, "a", errors="replace") as f:
f.seek(0, 2) f.seek(0, 2)
f.write(timestamp + output + "\n") f.write(timestamp + output + "\n")