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

fix win py3

上级 cd2f8f9e
...@@ -19,6 +19,7 @@ import os ...@@ -19,6 +19,7 @@ import os
import socket import socket
import sys import sys
import traceback import traceback
import six
global_envs = {} global_envs = {}
global_envs_flatten = {} global_envs_flatten = {}
...@@ -253,11 +254,19 @@ def load_yaml(config): ...@@ -253,11 +254,19 @@ def load_yaml(config):
use_full_loader = False use_full_loader = False
if os.path.isfile(config): if os.path.isfile(config):
if six.PY2:
with open(config, 'r') as rb: with open(config, 'r') as rb:
if use_full_loader: if use_full_loader:
_config = yaml.load(rb.read(), Loader=yaml.FullLoader) _config = yaml.load(rb.read(), Loader=yaml.FullLoader)
else: else:
_config = yaml.load(rb.read()) _config = yaml.load(rb.read())
return _config 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: else:
raise ValueError("config {} can not be supported".format(config)) 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.
先完成此消息的编辑!
想要评论请 注册