Skip to content

Commit

Permalink
Use resource to access schema file (#51)
Browse files Browse the repository at this point in the history
Signed-off-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com>
  • Loading branch information
hoangtungdinh committed Aug 22, 2024
1 parent d353e5b commit e51896b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions qc_openscenario/checks/schema_checker/valid_schema.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import importlib.resources
import os, logging

from dataclasses import dataclass
Expand Down Expand Up @@ -68,8 +69,9 @@ def check_rule(checker_data: models.CheckerData) -> None:
schema_files_dict = schema_files.SCHEMA_FILES

xsd_file = schema_files_dict[schema_version]
xsd_file_path = os.path.join("qc_openscenario", "schema", xsd_file)

xsd_file_path = str(
importlib.resources.files("qc_openscenario.schema").joinpath(xsd_file)
)
schema_compliant, errors = _is_schema_compliant(
checker_data.input_file_xml_root, xsd_file_path
)
Expand Down

0 comments on commit e51896b

Please sign in to comment.