From a871bcf8372a4355f5472ad5915fef41dbba2034 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 17 Aug 2017 21:56:43 +0800 Subject: [PATCH] bugfix: Python2 does not support encoding parameter in open function; use codecs.open instead. --- ate/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ate/utils.py b/ate/utils.py index 8ca075f2..093df3a8 100644 --- a/ate/utils.py +++ b/ate/utils.py @@ -1,3 +1,4 @@ +import codecs import hashlib import hmac import json @@ -5,8 +6,8 @@ import os.path import random import re import string - import yaml + from ate import exception try: @@ -32,11 +33,11 @@ def get_sign(*args): return sign def load_yaml_file(yaml_file): - with open(yaml_file, 'r+', encoding='utf-8') as stream: + with codecs.open(yaml_file, 'r+', encoding='utf-8') as stream: return yaml.load(stream) def load_json_file(json_file): - with open(json_file, encoding='utf-8') as data_file: + with codecs.open(json_file, encoding='utf-8') as data_file: return json.load(data_file) def load_testcases(testcase_file_path):