From 202505e78d7b004ace1624876f23b41635c5b89a Mon Sep 17 00:00:00 2001 From: Humphrey Date: Thu, 15 Mar 2018 14:49:39 +0800 Subject: [PATCH] fix python3 logging 'ascii' codec can't encode characters issue --- Base/BaseLog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Base/BaseLog.py b/Base/BaseLog.py index bbb323b..0974baa 100644 --- a/Base/BaseLog.py +++ b/Base/BaseLog.py @@ -24,7 +24,7 @@ def __init__(self, devices): self.logger.setLevel(logging.INFO) # create handler,write log - fh = logging.FileHandler(os.path.join(logPath, "outPut.log")) + fh = logging.FileHandler(os.path.join(logPath, "outPut.log"), encoding="UTF-8") # Define the output format of formatter handler formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') fh.setFormatter(formatter)