Return an empty dict if the module cannot be loaded

This commit is contained in:
Daniel Sheppard 2024-05-08 08:43:05 -05:00 committed by Jeremy Stretch
parent d7f652bcc7
commit d7d97b1b52
1 changed files with 4 additions and 1 deletions

View File

@ -60,7 +60,10 @@ def get_module_scripts(scriptmodule):
return cls.full_name.split(".", maxsplit=1)[1]
loader = SourceFileLoader(get_python_name(scriptmodule), get_full_path(scriptmodule))
module = loader.load_module()
try:
module = loader.load_module()
except FileNotFoundError:
return {}
scripts = {}
ordered = getattr(module, 'script_order', [])