Error when validating mapping result: jsonref fails on dereferencing common_properties_json_schema_cct1
On Windows 10 with Python 3.8.5 I installed hmc_schemas
with pip
. Now I want to validate one of our mapping results with schema_util.py
:
from pathlib import Path
import json
from hmc_schemas import validate_with
results_folder = Path("D:/WS_HMC/mapping_results/hubs_dumps/hub_ast/metadata_standards")
result_file = results_folder / "NetCDF.json"
with open(result_file, 'r', encoding='utf-8') as fileo:
result = json.load(fileo)
validate_with(result, 'metadata_standard')
This schema hmc_metadata_standard_1_0_0.json
references common_properties_json_schema_cct1.json
which unfortunately cannot be acquired on my system:
AttributeError: 'JsonRef' object has no attribute 'cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\sasquatch\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 1507, in open_local_file
stats = os.stat(localfile)
FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden: '\\common_properties_json_schema_cct1.json'
...
jsonref.JsonRefError: URLError: <urlopen error [WinError 2] Das System kann die angegebene Datei nicht finden: '\\common_properties_json_schema_cct1.json'>
I tracked the error down to line 114
in schema_util.py
where JsonRef.replace_refs
is called. And why is schemafile_common
in line 110
read but never used?
I am not familiar with JSON programming in Python, what am I doing wrong for this simple validation?