From 26bb902441d64032124968598323a1a29404f201 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Thu, 1 Feb 2024 14:13:55 +0100 Subject: [PATCH] Fix invalid type error when loading antimony model from file (#2281) * Fix invalid type error when loading antimony model from file `pathlib.Path` -> `str` * More informative exceptions --- python/sdist/amici/antimony_import.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/sdist/amici/antimony_import.py b/python/sdist/amici/antimony_import.py index cc23079787..545a2654bd 100644 --- a/python/sdist/amici/antimony_import.py +++ b/python/sdist/amici/antimony_import.py @@ -28,11 +28,13 @@ def antimony2sbml(ant_model: Union[str, Path]) -> str: is_file = False if is_file: - status = ant.loadAntimonyFile(ant_model) + status = ant.loadAntimonyFile(str(ant_model)) else: status = ant.loadAntimonyString(ant_model) if status < 0: - raise RuntimeError("Antimony model could not be loaded.") + raise RuntimeError( + f"Antimony model could not be loaded: {ant.getLastError()}" + ) if (main_module_name := ant.getMainModuleName()) is None: raise AssertionError("There is no Antimony module.")