未验证 提交 f27c147f 编写于 作者: S shaohua.zhang 提交者: GitHub

fix the file read

there may appear a error:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 379: illegal multibyte sequence
上级 efa97b69
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册