Example: http://bugs.python.org/issue8423 Index: Lib/test/regrtest.py =================================================================== --- Lib/test/regrtest.py (révision 80431) +++ Lib/test/regrtest.py (copie de travail) @@ -507,6 +507,13 @@ else: tests = iter(selected) + # set stdout encoder error handler to backslashreplace as done for stderr + # to avoid UnicodeEncodeError while printing a traceback + stdout = sys.stdout + sys.stdout = open(stdout.fileno(), 'w', + encoding=stdout.encoding, + errors="backslashreplace") + if use_mp: from threading import Thread from queue import Queue