From 4b00307425bb3219f269a13ba5a9526903d21ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Tue, 16 Mar 2010 13:19:21 +0000 Subject: Issue #6716/2: Backslash-replace error output in compilall. --- Lib/compileall.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Lib/compileall.py') diff --git a/Lib/compileall.py b/Lib/compileall.py index c3bf25a5db..eb5e24b318 100644 --- a/Lib/compileall.py +++ b/Lib/compileall.py @@ -104,7 +104,10 @@ def compile_file(fullname, ddir=None, force=0, rx=None, quiet=0): print('*** Error compiling', fullname, '...') else: print('*** ', end='') - print(err.msg) + # escape non-printable characters in msg + msg = err.msg.encode(sys.stdout.encoding, errors='backslashreplace') + msg = msg.decode(sys.stdout.encoding) + print(msg) success = 0 except (SyntaxError, UnicodeError, IOError) as e: if quiet: -- cgit v1.2.1