mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-15 01:57:06 +08:00
fixed a sys.path issue disscussed in github issue #7
This commit is contained in:
@@ -102,7 +102,7 @@ class Parser(CachedModule):
|
|||||||
content = {}
|
content = {}
|
||||||
exec_function('import %s as module' % name, content)
|
exec_function('import %s as module' % name, content)
|
||||||
self._module = content['module']
|
self._module = content['module']
|
||||||
self.sys_path, sys.path = sys.path, temp
|
sys.path = temp
|
||||||
|
|
||||||
if path:
|
if path:
|
||||||
self.sys_path.pop(0)
|
self.sys_path.pop(0)
|
||||||
|
|||||||
@@ -140,7 +140,11 @@ class ImportPath(object):
|
|||||||
# Override the sys.path. It works only good that way.
|
# Override the sys.path. It works only good that way.
|
||||||
# Injecting the path directly into `find_module` did not work.
|
# Injecting the path directly into `find_module` did not work.
|
||||||
sys.path, temp = builtin.module_find_path, sys.path
|
sys.path, temp = builtin.module_find_path, sys.path
|
||||||
i = imp.find_module(string)
|
try:
|
||||||
|
i = imp.find_module(string)
|
||||||
|
except:
|
||||||
|
sys.path = temp
|
||||||
|
raise
|
||||||
sys.path = temp
|
sys.path = temp
|
||||||
return i
|
return i
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user