joergbuchwald / ogs6py

Python-API for the OpenGeoSys (http://www.opengeosys.org) software.
BSD 3-Clause "New" or "Revised" License
16 stars 23 forks source link

`OSError` When Including XML File in Different Subdirectory #66

Closed Scinopode closed 1 year ago

Scinopode commented 1 year ago

Title: OSError When Including XML File in Different Subdirectory

Description:

When using ogs6py for automating project file configurations in a Python script, I encountered an OSError related to the XML include mechanism.

To Reproduce:

  1. Use ogs6py in a Python script (parent_dir/notebook.py) to automate the OGS project file configuration.
  2. Have a template project file available such as parent_dir/solution_path/template.prj
  3. Initialize an OGS instance like so:
    OGS(INPUT_FILE=f"{solution_path}/template.prj", PROJECT_FILE=f"{solution_path}/derived.prj")
  4. In template.prj, include an XML file located in the same directory (parent_dir/solution_path/qcurve.xml) using:
    <include file="qcurve.xml" />
  5. Run the Python script.

Expected Behavior:

The XML file should be included without any errors.

Actual Behavior:

An OSError occurs:

OSError: Error reading file 'qcurve.xml': failed to load external entity "qcurve.xml"

Additional Context:

Is there any specific path resolving behavior for included XML files when using ogs6py?