initialize.py: catch and handle any exception when import jedi_vim

This adds the traceback to it, which then will be displayed with
`v:exception` in the Vim part.
This commit is contained in:
Daniel Hahler
2016-03-18 23:08:48 +01:00
parent de793216f5
commit cdfb7a5b4f

View File

@@ -18,5 +18,10 @@ import traceback
# update the sys path to include the jedi_vim script # update the sys path to include the jedi_vim script
sys.path.insert(0, vim.eval('expand(s:script_path)')) sys.path.insert(0, vim.eval('expand(s:script_path)'))
import jedi_vim try:
sys.path.pop(1) import jedi_vim
except Exception as excinfo:
raise Exception('Failed to import jedi_vim: {0}\n{1}'.format(
excinfo, traceback.format_exc()))
finally:
sys.path.pop(1)