File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 1919import socket
2020import sys
2121import traceback
22+ import six
2223
2324global_envs = {}
2425global_envs_flatten = {}
@@ -253,11 +254,19 @@ def load_yaml(config):
253254 use_full_loader = False
254255
255256 if os .path .isfile (config ):
256- with open (config , 'r' ) as rb :
257- if use_full_loader :
258- _config = yaml .load (rb .read (), Loader = yaml .FullLoader )
259- else :
260- _config = yaml .load (rb .read ())
261- return _config
257+ if six .PY2 :
258+ with open (config , 'r' ) as rb :
259+ if use_full_loader :
260+ _config = yaml .load (rb .read (), Loader = yaml .FullLoader )
261+ else :
262+ _config = yaml .load (rb .read ())
263+ return _config
264+ else :
265+ with open (config , 'r' , encoding = "utf-8" ) as rb :
266+ if use_full_loader :
267+ _config = yaml .load (rb .read (), Loader = yaml .FullLoader )
268+ else :
269+ _config = yaml .load (rb .read ())
270+ return _config
262271 else :
263272 raise ValueError ("config {} can not be supported" .format (config ))
You can’t perform that action at this time.
0 commit comments