Index: leahi_dialin/dd/__init__.py =================================================================== diff -u -r2cfe3b26afa7d5ebdb1df6a7fdfd06532880713c -rbe6aa30cfb37a47935f3c114ecece9ee75809909 --- leahi_dialin/dd/__init__.py (.../__init__.py) (revision 2cfe3b26afa7d5ebdb1df6a7fdfd06532880713c) +++ leahi_dialin/dd/__init__.py (.../__init__.py) (revision be6aa30cfb37a47935f3c114ecece9ee75809909) @@ -1 +1,22 @@ -from .dialysate_delivery import DD \ No newline at end of file +import os +import json + +# mandatory import +# none + +file_name = "config.json" +sw_key = "SW" +config = {} +ok: bool = False +module_name = os.path.basename(os.path.dirname(__file__)) + +try: + with open(file_name, 'r') as file: config = json.load(file); ok = config[sw_key] +except FileNotFoundError: print(f"Error ({module_name}): The file '{file_name}' was not found." ) +except KeyError : print(f"Error ({module_name}): The key '{sw_key}' was not found." ) +except Exception as e : print(f"Error ({module_name}): An unexpected error occurred: {e}" ) + +if ok: + print(f"{sw_key} is set to bypass the auto imports in '{module_name}' module.") +else: + from .dialysate_delivery import DD \ No newline at end of file