From 480d2858826a53d180abaf3a792aa5e35d792c1f Mon Sep 17 00:00:00 2001 From: Chris McCormick Date: Tue, 26 Nov 2019 12:20:25 +0800 Subject: [PATCH] Guard against non-existent plugins dir. --- piku.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/piku.py b/piku.py index c93a96c..f33f924 100755 --- a/piku.py +++ b/piku.py @@ -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