From baf6240c57fbb94cb4501b11f6057d71171d8715 Mon Sep 17 00:00:00 2001 From: lokkelvin2 <56050360+lokkelvin2@users.noreply.github.com> Date: Mon, 13 Jul 2020 17:20:25 +0800 Subject: [PATCH] add encoding="utf-8" --- utils/io.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/io.py b/utils/io.py index faf00195..c1067726 100644 --- a/utils/io.py +++ b/utils/io.py @@ -13,7 +13,7 @@ class AttrDict(dict): def load_config(config_path): config = AttrDict() - with open(config_path, "r") as f: + with open(config_path, "r", encoding = "utf-8") as f: input_str = f.read() input_str = re.sub(r'\\\n', '', input_str) input_str = re.sub(r'//.*\n', '\n', input_str) @@ -23,7 +23,7 @@ def load_config(config_path): def copy_config_file(config_file, out_path, new_fields): - config_lines = open(config_file, "r").readlines() + config_lines = open(config_file, "r", encoding = "utf-8").readlines() # add extra information fields for key, value in new_fields.items(): if isinstance(value, str):