The encoding of sys.stderr can exist and be None.

This commit is contained in:
Sei Lisa 2019-05-01 01:22:54 +02:00
parent 2c94905f1e
commit 3cfbbb923c

View file

@ -45,7 +45,7 @@ def ReportError(script, e):
# When the encoding of stderr is unknown (e.g. when redirected to a file),
# output will be encoded in UTF-8; otherwise the terminal's encoding will
# be used.
enc = getattr(sys.stderr, 'encoding', 'utf8')
enc = getattr(sys.stderr, 'encoding', 'utf8') or 'utf8'
# Synchronize the UTF-8 encoded line with the output line in the
# terminal's encoding. We need to compensate for the fact that the