Skip to content

Commit

Permalink
Add control for exception (file not found) on python loader.
Browse files Browse the repository at this point in the history
  • Loading branch information
viferga committed May 27, 2021
1 parent cc47843 commit 9113282
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions source/loaders/py_loader/source/py_loader_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,8 @@ int py_loader_impl_initialize_import(loader_impl_py py_impl)
" return importlib.import_module(module_name)\n"
" else:\n"
" spec = importlib.util.spec_from_file_location(module_name, path)\n"
" if spec is None:\n"
" raise ModuleNotFoundError('File ' + path + ' could not be found')\n"
" m = importlib.util.module_from_spec(spec)\n"
" spec.loader.exec_module(m)\n"
" return m\n"
Expand Down

0 comments on commit 9113282

Please sign in to comment.