From 748a075f1af78686d5a89bbfc910d2e46f67b7a0 Mon Sep 17 00:00:00 2001 From: Thomas Wilson Date: Mon, 6 Jan 2020 18:14:04 +0800 Subject: [PATCH] Normalise path to both packages and modules --- shepherd/agent/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shepherd/agent/plugin.py b/shepherd/agent/plugin.py index 46c2388..e8fab61 100644 --- a/shepherd/agent/plugin.py +++ b/shepherd/agent/plugin.py @@ -171,7 +171,7 @@ def load_plugin(plugin_name, plugin_dir=None): mod = importlib.import_module(plugin_name) finally: sys.path = saved_syspath - modpath = getattr(mod, "__path__", mod.__file__) + modpath = getattr(mod, "__path__", [mod.__file__])[0] log.info(F"Loading custom plugin {plugin_name} from {modpath}") elif plugin_name in discover_installed_plugins():