Use python’s try/catch, not vim’s

Fixes #344
This commit is contained in:
ZyX 2013-03-22 16:50:06 +04:00
parent 127a600e1b
commit e151b600b2

View File

@ -21,14 +21,12 @@ let s:powerline_pyeval = get(g:, 'powerline_pyeval', s:powerline_pycmd.'eval')
let s:import_cmd = 'from powerline.vim import VimPowerline'
try
exec s:powerline_pycmd s:import_cmd
catch
" An error occurred while importing the module, it could be installed
" outside of Python's module search paths. Update sys.path and try again.
exec s:powerline_pycmd 'import sys, vim'
exec s:powerline_pycmd 'sys.path.append(vim.eval(''expand("<sfile>:h:h:h:h:h")''))'
try
exec s:powerline_pycmd s:import_cmd
exec s:powerline_pycmd "try:\n"
\ ." ".s:import_cmd."\n"
\ ."except ImportError:\n"
\ ." import sys, vim\n"
\ ." sys.path.append(vim.eval('expand(\"<sfile>:h:h:h:h:h\")'))\n"
\ ." ".s:import_cmd
let s:launched = 1
finally
if !exists('s:launched')
@ -37,9 +35,10 @@ catch
\ Python version (Powerline requires Python 2.6+ or 3.2+ to work). Please consult
\ the troubleshooting section in the documentation for possible solutions.')
finish
else
unlet s:launched
endif
endtry
endtry
if !get(g:, 'powerline_debugging_pyeval') && exists('*'. s:powerline_pyeval)
let s:pyeval = function(s:powerline_pyeval)