Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise RuntimeError when MeTTa extension is loaded with error #549

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading