diff --git a/moto/utilities/utils.py b/moto/utilities/utils.py index 01d20e47e..255d29199 100644 --- a/moto/utilities/utils.py +++ b/moto/utilities/utils.py @@ -1,6 +1,10 @@ import json import random import string +import six + +if six.PY2: + from io import open def random_string(length=None): @@ -18,5 +22,5 @@ def load_resource(filename): from pkg_resources import resource_filename load_resource(resource_filename(__name__, "resources/file.json")) """ - with open(filename, "r") as f: - return json.load(f, encoding="utf-8") + with open(filename, "r", encoding="utf-8") as f: + return json.load(f)