Do not force an encoding on config.log on python2 #1974

This commit is contained in:
Thomas Nagy 2017-07-19 22:38:12 +02:00
parent dd3a173e46
commit 8fedfef8a3
No known key found for this signature in database
GPG Key ID: 49B4C67C05277AAA
1 changed files with 5 additions and 1 deletions

View File

@ -328,7 +328,11 @@ def make_logger(path, name):
:type name: string
"""
logger = logging.getLogger(name)
hdlr = logging.FileHandler(path, 'w', encoding=sys.stdout.encoding)
if sys.hexversion > 0x3000000:
encoding = sys.stdout.encoding
else:
encoding = None
hdlr = logging.FileHandler(path, 'w', encoding=encoding)
formatter = logging.Formatter('%(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)