asam-ev / qc-openscenarioxml

6 stars 3 forks source link

Uncaught exception when LogicFile cannot be found #65

Open markuspi opened 1 week ago

markuspi commented 1 week ago

Describe the bug When the RoadNetwork > LogicFile points to a file that does not exist, an ungaught exception is thrown. This results in no result file being generated. The qc-framework thus does not get notified about the problem; the report does not indicate any failed checks.

To Reproduce Steps to reproduce the behavior:

  1. Use a valid XOSC file
  2. Change the LogicFile.filepath to a nonexistant file
  3. Run checker, observe an exception in the console log

Expected behavior No exception should be raised. A check error should be generated, indicating that the file does not exist. Subsequent checks should run normally.

Console Output

[...]>qc_runtime --config qc_config.xml --manifest "[...]\bin/../manifest/framework.json" --working_dir .
Registering manifest file at [...]\bin/../manifest/qc_opendrive.json
Registering manifest file at [...]\bin/../manifest/qc_openscenarioxml.json
Registering manifest file at [...]\bin/../manifest/report_gui.json
Registering manifest file at [...]\bin/../manifest/result_pooling.json
Registering manifest file at [...]\bin/../manifest/text_report.json
Executing checker bundles
Executing checker module:  xoscBundle
Executing command: cd %ASAM_QC_FRAMEWORK_WORKING_DIR% && qc_openscenario -c %ASAM_QC_FRAMEWORK_CONFIG_FILE%
Error occurred while executing the command.
Error message:
2024-09-30 11:02:19,978 - Initializing checks
2024-09-30 11:02:19,979 - Executing valid_xml_document check
2024-09-30 11:02:19,979 - - It is an xml document.
2024-09-30 11:02:19,980 - Executing root_tag_is_openscenario check
2024-09-30 11:02:19,980 - - Root tag is 'OpenSCENARIO'
2024-09-30 11:02:19,980 - Executing fileheader_is_present check
2024-09-30 11:02:19,980 - - Root tag contains FileHeader -> OK
2024-09-30 11:02:19,980 - Executing version_is_defined check
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "[...]\.venv\Scripts\qc_openscenario.exe\__main__.py", line 7, in <module>
  File "[...]\.venv\Lib\site-packages\qc_openscenario\main.py", line 244, in main
    run_checks(config, result)
  File "[...]\.venv\Lib\site-packages\qc_openscenario\main.py", line 180, in run_checks
    checker_data.xodr_root = utils.get_xodr_road_network(
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[...]\.venv\Lib\site-packages\qc_openscenario\checks\utils.py", line 138, in get_xodr_road_network
    xodr_root = get_root_without_default_namespace(filepath)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[...]\.venv\Lib\site-packages\qc_openscenario\checks\utils.py", line 21, in get_root_without_default_namespace
    with open(path, "rb") as raw_file:
         ^^^^^^^^^^^^^^^^
OSError: [Errno 22] Invalid argument: 'doesnotexist.xodr'
hoangtungdinh commented 4 days ago

Thanks @markuspi for reporting the issue. It will be fixed once https://github.com/asam-ev/qc-openscenarioxml/pull/68 is merged.