From 2badc30db9b6538cb1ae51a7ddbac29e4f6b14f0 Mon Sep 17 00:00:00 2001 From: lejeune quentin Date: Thu, 13 Apr 2023 13:16:24 +0000 Subject: [PATCH] [FIX] hw_drivers: Try catch the load of iot handlers Currently, if a problem occurs during the loading of iot handlers (drivers or interfaces), all loading of iot handlers is compromised. With this FIX we display the Exception and the file concerned without blocking the operation of the iot closes odoo/odoo#118557 X-original-commit: 3b717b0d66ea2656e5058ab3df0b068fae8b08c8 Signed-off-by: Quentin Lejeune (qle) --- addons/hw_drivers/tools/helpers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/hw_drivers/tools/helpers.py b/addons/hw_drivers/tools/helpers.py index 99866148bf4d8..ebfe3d7d50a3e 100644 --- a/addons/hw_drivers/tools/helpers.py +++ b/addons/hw_drivers/tools/helpers.py @@ -353,7 +353,11 @@ def load_iot_handlers(): spec = util.spec_from_file_location(file, str(Path(path).joinpath(file))) if spec: module = util.module_from_spec(spec) - spec.loader.exec_module(module) + try: + spec.loader.exec_module(module) + except Exception as e: + _logger.error('Unable to load file: %s ', file) + _logger.error('An error encountered : %s ', e) lazy_property.reset_all(http.root) def list_file_by_os(file_list):