[core/config] Skip unavailable modules
If a module cannot be loaded (presumably, because some python modules are missing), do not show them in the list of available modules. fixes #237
This commit is contained in:
parent
96326da78a
commit
0c03c1c48b
1 changed files with 9 additions and 6 deletions
|
@ -35,12 +35,15 @@ class print_usage(argparse.Action):
|
||||||
|
|
||||||
def print_modules(self):
|
def print_modules(self):
|
||||||
for m in bumblebee.engine.all_modules():
|
for m in bumblebee.engine.all_modules():
|
||||||
mod = importlib.import_module("bumblebee.modules.{}".format(m["name"]))
|
try:
|
||||||
print(textwrap.fill("{}:".format(m["name"]), 80,
|
mod = importlib.import_module("bumblebee.modules.{}".format(m["name"]))
|
||||||
initial_indent=self._indent*2, subsequent_indent=self._indent*2))
|
print(textwrap.fill("{}:".format(m["name"]), 80,
|
||||||
for line in mod.__doc__.split("\n"):
|
initial_indent=self._indent*2, subsequent_indent=self._indent*2))
|
||||||
print(textwrap.fill(line, 80,
|
for line in mod.__doc__.split("\n"):
|
||||||
initial_indent=self._indent*3, subsequent_indent=self._indent*6))
|
print(textwrap.fill(line, 80,
|
||||||
|
initial_indent=self._indent*3, subsequent_indent=self._indent*6))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def create_parser():
|
def create_parser():
|
||||||
"""Create the argument parser"""
|
"""Create the argument parser"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue