[engine] do not fail on module import
If a module import fails, simply log a warning. The module, clearly, cannot be used, though. fixes #227
This commit is contained in:
parent
bb38593f2d
commit
186169343d
1 changed files with 6 additions and 3 deletions
|
@ -216,9 +216,12 @@ class Engine(object):
|
||||||
def _read_aliases(self):
|
def _read_aliases(self):
|
||||||
result = {}
|
result = {}
|
||||||
for module in all_modules():
|
for module in all_modules():
|
||||||
|
try:
|
||||||
mod = importlib.import_module("bumblebee.modules.{}".format(module["name"]))
|
mod = importlib.import_module("bumblebee.modules.{}".format(module["name"]))
|
||||||
for alias in getattr(mod, "ALIASES", []):
|
for alias in getattr(mod, "ALIASES", []):
|
||||||
result[alias] = module["name"]
|
result[alias] = module["name"]
|
||||||
|
except Exception as error:
|
||||||
|
log.warning("failed to import {}: {}".format(module["name"], str(error)))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _load_module(self, module_name, config_name=None):
|
def _load_module(self, module_name, config_name=None):
|
||||||
|
|
Loading…
Reference in a new issue