Latest jedi-vim and Python 3.7.0 throws
Error detected while processing function jedi#init_python[4]..<SNR>23_init_python[27]..jedi#setup_python_imports:
line 25:
/must>not&exist/foo:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
when opening a python file.
minimal-vimrc:
set nocompatible
let script_dir = fnamemodify(expand('<sfile>'), ':h')
let &runtimepath .= ','.script_dir.','.script_dir.'/after'
syntax on
filetype plugin indent on
Using Python version: 3
3.7.0 (default, Jul 9 2018, 12:14:11), [Clang 9.1.0 (clang-902.0.39.2)]
/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site.py
/Users/x/.vim/plugged/jedi-vim/pythonx/jedi/jedi/__init__.py
<Environment: 2.7.15 in /usr/local>
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/site-packages
/usr/local/Cellar/protobuf/3.6.0/libexec/lib/python2.7/site-packages
omnifunc=python3complete#Complete
Last set from /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/ftplugin/python.vim
completeopt=menuone,longest,preview
Last set from ~/.vim/plugged/jedi-vim/plugin/jedi.vim
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul 9 2018 13:36:24)
macOS version
Included patches: 1-150
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+acl -clientserver +dialog_con +find_in_path +keymap +modify_fname +multi_byte +profile +statusline +textobjects +vreplace -xterm_save
+arabic +clipboard +diff +float +lambda +mouse +multi_lang -python -sun_workshop +timers +wildignore
+autocmd +cmdline_compl +digraphs +folding +langmap -mouseshape -mzscheme +python3 +syntax +title +wildmenu
-autoservername +cmdline_hist -dnd -footer +libcall +mouse_dec +netbeans_intg +quickfix +tag_binary -toolbar +windows
-balloon_eval +cmdline_info -ebcdic +fork() +linebreak -mouse_gpm +num64 +reltime +tag_old_static +user_commands +writebackup
+balloon_eval_term +comments +emacs_tags -gettext +lispindent -mouse_jsbterm +packages +rightleft -tag_any_white +vartabs -X11
-browse +conceal +eval -hangul_input +listcmds +mouse_netterm +path_extra +ruby -tcl +vertsplit -xfontset
++builtin_terms +cryptv +ex_extra +iconv +localmap +mouse_sgr +perl +scrollbind +termguicolors +virtualedit -xim
+byte_offset +cscope +extra_search +insert_expand +lua -mouse_sysmouse +persistent_undo +signs +terminal +visual -xpm
+channel +cursorbind +farsi +job +menu +mouse_urxvt +postscript +smartindent +terminfo +visualextra -xsmp
+cindent +cursorshape +file_in_path +jumplist +mksession +mouse_xterm +printer +startuptime +termresponse +viminfo -xterm_clipboard
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o vim -lncurses -liconv -framework AppKit -pagezero_size 10000 -image_base 100000000 -L/usr/local/opt/luajit/lib -lluajit-5.1 -mmacosx-version-min=10.13 -fstack-protector-strong -L/usr/local/lib -L/usr/local/Cellar/perl/5.28.0/lib/perl5/5.28.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation -lruby.2.5.1 -lobjc
Messages maintainer: Bram Moolenaar <[email protected]>
"test_integration.py" 2L, 70C
Error detected while processing function jedi#init_python[4]..<SNR>23_init_python[27]..jedi#setup_python_imports:
line 25:
/must>not&exist/foo:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
:scriptnames
1: ~/.vim/plugged/jedi-vim/vimrc.minimal
2: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/syntax/syntax.vim
3: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/syntax/synload.vim
4: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/syntax/syncolor.vim
5: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/filetype.vim
6: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/ftplugin.vim
7: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/indent.vim
8: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/getscriptPlugin.vim
9: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/gzip.vim
10: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/logiPat.vim
11: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/manpager.vim
12: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/matchparen.vim
13: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/netrwPlugin.vim
14: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/rrhelper.vim
15: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/spellfile.vim
16: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/tarPlugin.vim
17: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/tohtml.vim
18: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/vimballPlugin.vim
19: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/plugin/zipPlugin.vim
20: ~/.vim/plugged/jedi-vim/plugin/jedi.vim
21: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/syntax/python.vim
22: ~/.vim/plugged/jedi-vim/after/syntax/python.vim
23: ~/.vim/plugged/jedi-vim/autoload/jedi.vim
24: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/ftplugin/python.vim
25: ~/.vim/plugged/jedi-vim/ftplugin/python/jedi.vim
26: ~/.vim/plugged/jedi-vim/after/ftplugin/python/jedi.vim
27: /usr/local/Cellar/vim/8.1.0150/share/vim/vim81/indent/python.vim
My guess is that PEP 565 in Python 3.7.0 is allowing DeprecationWarnings to bubble up by default, as this issue doesn't happen in Python 3.6.5.
Python 3.7.0 (default, Jul 9 2018, 12:14:11)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import imp
__main__:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
>>>
vs
Python 3.6.5 (default, Jun 17 2018, 12:13:06)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import imp
>>>
From some more digging, it looks like vim itself is importing imp
, hence why the line the error is being thrown on makes no sense (/must>not&exist/foo:1
).
Looks like it's tracked upstream here:
https://github.com/vim/vim/issues/3117
With a workaround here:
https://github.com/vim/vim/issues/3117#issuecomment-402622616
Might be worth patching something into jedi-vim to handle cases of people using an older vim with Python 3.7+
We could probably catch the warning somehow, but IMO 3.7 is so new and jedi only supports it partially, we could also wait a bit and see if their issue fixes it.
@optix2000 Thank you! Had same issue.
I commented this line and everything works from me:
import imp
Something maybe broken? Any better solution?
The issue was solved in VIM 8.1.201
https://github.com/vim/vim/issues/3117#issuecomment-406868685
I'm therefore closing this issue. No need for us to fix anything anymore. Just upgrade VIM or use the recommendation at https://github.com/vim/vim/issues/3117#issuecomment-402622616
Most helpful comment
From some more digging, it looks like vim itself is importing
imp
, hence why the line the error is being thrown on makes no sense (/must>not&exist/foo:1
).Looks like it's tracked upstream here:
https://github.com/vim/vim/issues/3117
With a workaround here:
https://github.com/vim/vim/issues/3117#issuecomment-402622616
Might be worth patching something into jedi-vim to handle cases of people using an older vim with Python 3.7+