From 7000fcda34ec1761f57d53f29bf56d07a4614854 Mon Sep 17 00:00:00 2001 From: Goffi Date: Mon, 1 Jun 2020 11:14:20 +0200 Subject: [PATCH] tools (common/dynamic_import): log a warning if bridge can't be imported --- sat/tools/common/dynamic_import.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sat/tools/common/dynamic_import.py b/sat/tools/common/dynamic_import.py index 1b3e6cb3..d0a34a93 100644 --- a/sat/tools/common/dynamic_import.py +++ b/sat/tools/common/dynamic_import.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 - -# SàT: a XMPP +# SàT: an XMPP client # Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org) # This program is free software: you can redistribute it and/or modify @@ -20,6 +19,10 @@ """ tools dynamic import """ from importlib import import_module +from sat.core.log import getLogger + + +log = getLogger(__name__) def bridge(name, module_path="sat.bridge"): @@ -34,6 +37,7 @@ def bridge(name, module_path="sat.bridge"): except ImportError: try: bridge_module = import_module(module_path + "." + name + "_bridge") - except ImportError: + except ImportError as e: + log.warning(f"Can't import bridge {name!r}: {e}") bridge_module = None return bridge_module