From 624699d628f8e11be45f24977944fea06a3054c9 Mon Sep 17 00:00:00 2001 From: Yaacov Zamir Date: Tue, 9 Jan 2024 17:16:29 +0200 Subject: [PATCH] try load module Signed-off-by: Yaacov Zamir --- rose/main.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/rose/main.py b/rose/main.py index 5e2fe86..72aaff1 100644 --- a/rose/main.py +++ b/rose/main.py @@ -16,10 +16,15 @@ def load_driver_module(driver_path): Raises: Exception if the module cannot be loaded """ - spec = importlib.util.spec_from_file_location("driver_module", driver_path) - driver_module = importlib.util.module_from_spec(spec) - spec.loader.exec_module(driver_module) - return driver_module + try: + spec = importlib.util.spec_from_file_location("driver_module", driver_path) + driver_module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(driver_module) + return driver_module + except Exception as e: + raise ImportError( + f"Error loading driver module from path {driver_path}: {str(e)}" + ) def main():