From cdfb7a5b4fb888d877b2a3119eea183920105ec2 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 18 Mar 2016 23:08:48 +0100 Subject: [PATCH] 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. --- initialize.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/initialize.py b/initialize.py index 8ab8ddf..10687ca 100644 --- a/initialize.py +++ b/initialize.py @@ -18,5 +18,10 @@ import traceback # update the sys path to include the jedi_vim script sys.path.insert(0, vim.eval('expand(s:script_path)')) -import jedi_vim -sys.path.pop(1) +try: + 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)