From 75c9a9e60bccd6221d788fce6c8ad447752457a0 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 25 Aug 2025 14:31:22 +0200 Subject: [PATCH] `write_sbml`: mkdir Create output directory in `write_sbml` if necessary. --- petab/v1/sbml.py | 1 + 1 file changed, 1 insertion(+) diff --git a/petab/v1/sbml.py b/petab/v1/sbml.py index 9e5549d2..b939e45e 100644 --- a/petab/v1/sbml.py +++ b/petab/v1/sbml.py @@ -169,6 +169,7 @@ def write_sbml(sbml_doc: libsbml.SBMLDocument, filename: Path | str) -> None: sbml_doc: SBML document containing the SBML model filename: Destination file name """ + Path(filename).parent.mkdir(parents=True, exist_ok=True) sbml_writer = libsbml.SBMLWriter() ret = sbml_writer.writeSBMLToFile(sbml_doc, str(filename)) if not ret: