Mercurial > libervia-backend
diff sat/tools/common/dynamic_import.py @ 3290:3ff952c042ae
tools (common/dynamic_import): log a warning if bridge can't be imported
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 01 Jun 2020 11:14:20 +0200 |
parents | 559a625a236b |
children | be6d91572633 |
line wrap: on
line diff
--- a/sat/tools/common/dynamic_import.py Fri May 29 21:55:45 2020 +0200 +++ b/sat/tools/common/dynamic_import.py Mon Jun 01 11:14:20 2020 +0200 @@ -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 @@ 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