After an update to Python 3.7.0 (coming from 3.6.x) I (and others) get the warning
/must>not&exist/foo:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
I'm running macOS. The update was triggered by Homebrew package manager.
See also here on: https://stackoverflow.com/questions/51137328/deprecationwarning-when-starting-vim-with-powerline-enabled-since-python-upgrade
Powerline uses imp module in linter and tests, in regular code it only uses __import__ function. This still needs to be changed (so better not to close the issue), but fixing those usages would not do anything to fix the warning. Given that you see warning from /must>not&exist/foo you are seeing error from imp used by vim (specifically line 6808 of src/if_py_both.h), not by powerline.
Looks like there's already an issue in the Vim repo addressing this.
Workaround found in https://github.com/vim/vim/issues/3117:
either add this to ~/.vimrc before importing powerline
if has('python3')
silent! python3 1
endif
or preprend silent! to the first powerline import command, like:
silent! python3 from powerline.vim import setup as powerline_setup
python3 powerline_setup()
python3 del powerline_setup
@erikw There is no need to prepend silent to all powerline commands.
You're right. When I tried before it looked like it was needed for all 3, but I tried again and only the first is needed, like expected. I updated my previous post.
Thanks!
Most helpful comment
Workaround found in https://github.com/vim/vim/issues/3117:
either add this to
~/.vimrcbefore importing powerlineor preprend
silent!to the first powerline import command, like: