From f936cc7c7394a4694414d60425ef76c9b9fa7c0c Mon Sep 17 00:00:00 2001 From: yzamir Date: Tue, 12 Sep 2023 08:39:20 +0300 Subject: [PATCH] fix pydoc in loading driver Signed-off-by: yzamir --- rose/client/main.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/rose/client/main.py b/rose/client/main.py index 15f20c7e..d57bc382 100644 --- a/rose/client/main.py +++ b/rose/client/main.py @@ -9,20 +9,17 @@ def load_driver_module(driver_path): """ Load the driver module from the specified path. - :param driver_path: Path to the driver module. - :return: The loaded module. - :raises ImportError: If there's an issue loading the module. + Arguments: + file_path (str): The path to the driver module + Returns: + Driver module (module) + Raises: + Exception if the module cannot be loaded """ - 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)}" - ) - + 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 def main(): """