Skip to content

Commit

Permalink
Raise RuntimeError when MeTTa extension is loaded with error
Browse files Browse the repository at this point in the history
  • Loading branch information
vsbogd committed Jan 26, 2024
1 parent edd23aa commit 2335754
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/hyperon/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ def load_py_module_from_mod_or_file(self, mod_name):
search_path_idx += 1

if found_path is not None:
MeTTa.load_py_module_from_path(self, mod_name, found_path)
module = MeTTa.load_py_module_from_path(self, mod_name, found_path)
if module is None:
raise RuntimeError("Failed to load module " + mod_name + "; error while loading file: " + file_name)
else:
raise RuntimeError("Failed to load module " + mod_name + "; could not locate file: " + file_name)

Expand All @@ -163,7 +165,7 @@ def load_py_module_from_path(self, mod_name, path):
mod_name = mod_name.split(os.sep)[-1]
sys.modules[mod_name] = module
spec.loader.exec_module(module)
MeTTa.load_py_module(self, mod_name)
return MeTTa.load_py_module(self, mod_name)

def import_file(self, fname):
"""Loads the program file and runs it"""
Expand Down

0 comments on commit 2335754

Please sign in to comment.