提交 47e209bd 编写于 作者: G gentelyang

fix win py3

上级 cd2f8f9e
......@@ -19,6 +19,7 @@ import os
import socket
import sys
import traceback
import six
global_envs = {}
global_envs_flatten = {}
......@@ -253,11 +254,19 @@ def load_yaml(config):
use_full_loader = False
if os.path.isfile(config):
with open(config, 'r') as rb:
if use_full_loader:
_config = yaml.load(rb.read(), Loader=yaml.FullLoader)
else:
_config = yaml.load(rb.read())
return _config
if six.PY2:
with open(config, 'r') as rb:
if use_full_loader:
_config = yaml.load(rb.read(), Loader=yaml.FullLoader)
else:
_config = yaml.load(rb.read())
return _config
else:
with open(config, 'r', encoding="utf-8") as rb:
if use_full_loader:
_config = yaml.load(rb.read(), Loader=yaml.FullLoader)
else:
_config = yaml.load(rb.read())
return _config
else:
raise ValueError("config {} can not be supported".format(config))
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册