From 64465dae8daf33f5c7ceae7a1fde750f76e02e38 Mon Sep 17 00:00:00 2001 From: David Halter Date: Sun, 30 Dec 2012 10:32:11 +0100 Subject: [PATCH] fix problem with empty import_paths --- jedi/imports.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jedi/imports.py b/jedi/imports.py index de0af587..7563dcdb 100644 --- a/jedi/imports.py +++ b/jedi/imports.py @@ -151,10 +151,11 @@ class ImportPath(parsing.Base): # sys.path. Therefore look if gunicorn is a parent directory, #56. parts = self.file_path.split(os.path.sep) in_path = [] - for i, p in enumerate(parts): - if p == self.import_path[0]: - new = os.path.sep.join(parts[:i]) - in_path.append(new) + if self.import_path: + for i, p in enumerate(parts): + if p == self.import_path[0]: + new = os.path.sep.join(parts[:i]) + in_path.append(new) module = self.import_stmt.get_parent_until() return in_path + modules.sys_path_with_modifications(module)