From c4c459972a7bfa987e4ffd25fecdc7b464d20958 Mon Sep 17 00:00:00 2001 From: cattodotpy Date: Thu, 21 Nov 2024 21:29:05 +0800 Subject: [PATCH] Add error handling for frame processor module loading --- modules/processors/frame/core.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/processors/frame/core.py b/modules/processors/frame/core.py index 92554e6..b715e17 100644 --- a/modules/processors/frame/core.py +++ b/modules/processors/frame/core.py @@ -19,10 +19,13 @@ FRAME_PROCESSORS_INTERFACE = [ def load_frame_processor_module(frame_processor: str) -> Any: - frame_processor_module = importlib.import_module(f'modules.processors.frame.{frame_processor}') - for method_name in FRAME_PROCESSORS_INTERFACE: - if not hasattr(frame_processor_module, method_name): - sys.exit() + try: + frame_processor_module = importlib.import_module(f'modules.processors.frame.{frame_processor}') + for method_name in FRAME_PROCESSORS_INTERFACE: + if not hasattr(frame_processor_module, method_name): + sys.exit() + except ImportError: + print(f'Error: Could not load frame processor module "{frame_processor}"') return frame_processor_module