From 3cfbbb923c5f85ce37efbb693294d25d4dfc20f0 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Wed, 1 May 2019 01:22:54 +0200 Subject: [PATCH] The encoding of sys.stderr can exist and be None. --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 9bfdf10..6655a62 100755 --- a/main.py +++ b/main.py @@ -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