Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vim: DeprecationWarning for imp module after update to Python 3.7.0 #1925

Open
sbusch opened this issue Jul 3, 2018 · 5 comments
Open

vim: DeprecationWarning for imp module after update to Python 3.7.0 #1925

sbusch opened this issue Jul 3, 2018 · 5 comments

Comments

@sbusch
Copy link

sbusch commented Jul 3, 2018

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

@ZyX-I
Copy link
Contributor

ZyX-I commented Jul 3, 2018

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.

@moritzreiter
Copy link

Looks like there's already an issue in the Vim repo addressing this.

@erikw
Copy link

erikw commented Jul 5, 2018

Workaround found in vim/vim#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

@ZyX-I
Copy link
Contributor

ZyX-I commented Jul 5, 2018

@erikw There is no need to prepend silent to all powerline commands.

@erikw
Copy link

erikw commented Jul 5, 2018

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants