Skip to content

Commit

Permalink
ModuleNotFoundError
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Nov 26, 2024
1 parent 010ee0b commit 17aa09f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions python/sdist/amici/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,20 @@ def import_model_module(
module_name,
f"_{module_name}{ext_suffix}",
)
# if we import a matlab-generated model where the extension
# is in a different directory
needed_file_matlab = Path(
module_path,
f"_{module_name}{ext_suffix}",
)
if not needed_file.exists():
# if we import a matlab-generated model where the extension
# is in a different directory
needed_file = Path(
module_path,
f"_{module_name}{ext_suffix}",
)
if needed_file_matlab.exists():
needed_file = needed_file_matlab
else:
raise ModuleNotFoundError(
f"Cannot find extension module for {module_name} in "
f"{module_path}."
)

if not loaded_file.samefile(needed_file):
# this is not the right module, and we can't unload it
Expand Down

0 comments on commit 17aa09f

Please sign in to comment.