From a3bde5e682b7de59b2de0475781203661e1530ff Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 10 Dec 2019 11:08:44 +0000 Subject: [PATCH] fix ModuleManager.find_module() - don't set `path` until it's actually found --- src/ModuleManager.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/ModuleManager.py b/src/ModuleManager.py index 4625d27a..10e4fb58 100644 --- a/src/ModuleManager.py +++ b/src/ModuleManager.py @@ -159,16 +159,15 @@ class ModuleManager(object): paths = self._module_paths(name) path = None - for path in paths: - if os.path.isdir(path): + for possible_path in paths: + if os.path.isdir(possible_path): type = ModuleType.DIRECTORY - path = os.path.join(path, "__init__.py") + possible_path = os.path.join(possible_path, "__init__.py") else: - possible_path = "%s.py" % path - if os.path.isfile(possible_path): - path = possible_path + possible_path = "%s.py" % possible_path - if path: + if os.path.isfile(possible_path): + path = possible_path break if not path: