Guard against non-existent plugins dir.

pull/129/head
Chris McCormick 2019-11-26 12:20:25 +08:00
rodzic 5ac6ae2d1d
commit 480d285882
1 zmienionych plików z 8 dodań i 7 usunięć

15
piku.py
Wyświetl plik

@ -1386,13 +1386,14 @@ def _get_plugin_commands(path):
sys_path.append(abspath(path))
cli_commands = []
for item in listdir(path):
module_path = join(path, item)
if not isdir(module_path):
continue
module = import_module(item)
if hasattr(module, 'cli_commands'):
cli_commands.append(module.cli_commands())
if isdir(path):
for item in listdir(path):
module_path = join(path, item)
if not isdir(module_path):
continue
module = import_module(item)
if hasattr(module, 'cli_commands'):
cli_commands.append(module.cli_commands())
return cli_commands