Skip to content

Commit

Permalink
Fix invalid type error when loading antimony model from file (#2281)
Browse files Browse the repository at this point in the history
* Fix invalid type error when loading antimony model from file

`pathlib.Path` -> `str`

* More informative exceptions
  • Loading branch information
dweindl authored Feb 1, 2024
1 parent 7946710 commit 26bb902
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/sdist/amici/antimony_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down

0 comments on commit 26bb902

Please sign in to comment.