From 0b67a08e48ee4c1430a3557f9bbccc150547aacc Mon Sep 17 00:00:00 2001 From: Aldo Stracquadanio Date: Mon, 25 Mar 2013 19:30:58 +0000 Subject: [PATCH] Using PathFinder rather than find_loader to correctly handle paths Using PathFinder rather than find_loader to correctly handle from ... import ... Moved away from find_loader in favour of PathFinder also when using sys.path --- jedi/_compatibility.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jedi/_compatibility.py b/jedi/_compatibility.py index 331c1f11..e15ba463 100644 --- a/jedi/_compatibility.py +++ b/jedi/_compatibility.py @@ -22,9 +22,11 @@ def find_module_py33(string, path=None): returning = (None, None, None) importing = None if path is not None: - importing = importlib.find_loader(string, path) + importing = importlib.machinery.PathFinder.find_module(string, path) else: - importing = importlib.find_loader(string) + importing = importlib.machinery.PathFinder.find_module(string, sys.path) + if importing is None: + importing = importlib.find_loader(string) if importing is None: raise ImportError