forked from VimPlug/jedi
some builtin modules have a very strange import behaviour. removes the stacktrace of #59
This commit is contained in:
@@ -101,8 +101,13 @@ class Parser(CachedModule):
|
|||||||
|
|
||||||
temp, sys.path = sys.path, self.sys_path
|
temp, sys.path = sys.path, self.sys_path
|
||||||
content = {}
|
content = {}
|
||||||
exec_function('import %s as module' % name, content)
|
try:
|
||||||
self._module = content['module']
|
exec_function('import %s as module' % name, content)
|
||||||
|
self._module = content['module']
|
||||||
|
except AttributeError:
|
||||||
|
# use sys.modules, because you cannot access some modules
|
||||||
|
# directly. -> #59
|
||||||
|
self._module = sys.modules[name]
|
||||||
sys.path = temp
|
sys.path = temp
|
||||||
|
|
||||||
if path:
|
if path:
|
||||||
|
|||||||
Reference in New Issue
Block a user