Skip to content

Commit

Permalink
Replace pkg_resources.resource_string
Browse files Browse the repository at this point in the history
Use an approach similar to the previous commit.
  • Loading branch information
victorlin committed Sep 20, 2023
1 parent cb9cf73 commit be83c92
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions augur/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/
Expand Down

0 comments on commit be83c92

Please sign in to comment.