From f27c147fd6ddcafd75b920f835c426da0c8ed81c Mon Sep 17 00:00:00 2001 From: "shaohua.zhang" Date: Thu, 27 Aug 2020 14:57:02 +0800 Subject: [PATCH] fix the file read there may appear a error: UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 379: illegal multibyte sequence --- tools/program.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/program.py b/tools/program.py index 6d8b9937..af8ceabe 100755 --- a/tools/program.py +++ b/tools/program.py @@ -89,13 +89,13 @@ def load_config(file_path): merge_config(default_config) _, ext = os.path.splitext(file_path) assert ext in ['.yml', '.yaml'], "only support yaml files for now" - merge_config(yaml.load(open(file_path), Loader=yaml.Loader)) + merge_config(yaml.load(open(file_path, 'rb'), Loader=yaml.Loader)) assert "reader_yml" in global_config['Global'],\ "absence reader_yml in global" reader_file_path = global_config['Global']['reader_yml'] _, ext = os.path.splitext(reader_file_path) assert ext in ['.yml', '.yaml'], "only support yaml files for reader" - merge_config(yaml.load(open(reader_file_path), Loader=yaml.Loader)) + merge_config(yaml.load(open(reader_file_path, 'rb'), Loader=yaml.Loader)) return global_config -- GitLab