diff --git a/augur/validate.py b/augur/validate.py index 3c42c7b8f..50b2927c1 100644 --- a/augur/validate.py +++ b/augur/validate.py @@ -3,16 +3,15 @@ """ import sys -import os from collections import defaultdict import json import jsonschema import jsonschema.exceptions import re from itertools import groupby -from pkg_resources import resource_string from textwrap import indent from typing import Iterable, Union +from augur.data import as_file from augur.io.print import print_err from augur.io.json import shorten_as_json from .validate_export import verifyMainJSONIsInternallyConsistent, verifyMetaAndOrTreeJSONsAreInternallyConsistent @@ -31,7 +30,8 @@ def load_json_schema(path): (located in augur/data) ''' try: - schema = json.loads(resource_string(__package__, os.path.join("data", path))) + with as_file(path) as file, open(file, "r", encoding = "utf-8") as fh: + schema = json.load(fh) except json.JSONDecodeError as err: raise ValidateError("Schema {} is not a valid JSON file. Error: {}".format(path, err)) # check loaded schema is itself valid -- see http://python-jsonschema.readthedocs.io/en/latest/errors/