From d7d97b1b5261ab5c08c1bc952d9fbe3ab78f3989 Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Wed, 8 May 2024 08:43:05 -0500 Subject: [PATCH] Return an empty dict if the module cannot be loaded --- netbox/extras/migrations/0109_script_model.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/netbox/extras/migrations/0109_script_model.py b/netbox/extras/migrations/0109_script_model.py index 7570077a7..6bfd2c14c 100644 --- a/netbox/extras/migrations/0109_script_model.py +++ b/netbox/extras/migrations/0109_script_model.py @@ -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', [])