tools (common/dynamic_import): log a warning if bridge can't be imported
This commit is contained in:
parent
5a14c5aebd
commit
7000fcda34
1 changed files with 7 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue