fix ModuleManager.find_module() - don't set path until it's actually found

This commit is contained in:
jesopo 2019-12-10 11:08:44 +00:00
parent 671e259ada
commit a3bde5e682

View file

@ -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
possible_path = "%s.py" % possible_path
if os.path.isfile(possible_path):
path = possible_path
if path:
break
if not path: