Add error handling for frame processor module loading
parent
b7d9889565
commit
c4c459972a
|
@ -19,10 +19,13 @@ FRAME_PROCESSORS_INTERFACE = [
|
||||||
|
|
||||||
|
|
||||||
def load_frame_processor_module(frame_processor: str) -> Any:
|
def load_frame_processor_module(frame_processor: str) -> Any:
|
||||||
|
try:
|
||||||
frame_processor_module = importlib.import_module(f'modules.processors.frame.{frame_processor}')
|
frame_processor_module = importlib.import_module(f'modules.processors.frame.{frame_processor}')
|
||||||
for method_name in FRAME_PROCESSORS_INTERFACE:
|
for method_name in FRAME_PROCESSORS_INTERFACE:
|
||||||
if not hasattr(frame_processor_module, method_name):
|
if not hasattr(frame_processor_module, method_name):
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
except ImportError:
|
||||||
|
print(f'Error: Could not load frame processor module "{frame_processor}"')
|
||||||
return frame_processor_module
|
return frame_processor_module
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue