diff options
author | Julien Malard <julien.malard@mail.mcgill.ca> | 2018-09-09 02:01:26 +0530 |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2018-09-08 16:31:26 -0400 |
commit | 64f5d63b221c89c3ef543f4ef10a99ff0027a63c (patch) | |
tree | 03786f5766f1108b7a9f59d3fcb53a48bf90cd3d | |
parent | 4a6183a2492528b3072f91cd221c86bee8853b09 (diff) | |
download | python-setuptools-git-64f5d63b221c89c3ef543f4ef10a99ff0027a63c.tar.gz |
bpo-34421 avoid unicode error in distutils logging (GH-8799)
This caused installation errors in some cases on Windows.
Patch by Julien Malard.
-rw-r--r-- | log.py | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -31,7 +31,10 @@ class Log: # emulate backslashreplace error handler encoding = stream.encoding msg = msg.encode(encoding, "backslashreplace").decode(encoding) - stream.write('%s\n' % msg) + try: + stream.write('%s\n' % msg) + except UnicodeEncodeError: + stream.write('%s\n' % msg.encode('unicode-escape').decode('ascii')) stream.flush() def log(self, level, msg, *args): |