MatchTagAlways icon indicating copy to clipboard operation
MatchTagAlways copied to clipboard

Getting a deprecation warning using python 3.7

Open sarahsturgeon opened this issue 7 years ago • 7 comments

"lib/object_generators/object_generators.rb" 1L, 1C
Error detected while processing /root/.vim/bundle/MatchTagAlways/autoload/MatchTagAlways.vim:
line   28:
/must>not&exist/foo:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

:echo has('python') => 0 :echo has('python3') => 1

I don't see anyone else talking about this so I reckon I might be doing something wrong?

I compiled vim from source with python3 (not python2) and I pointed it at my python 3.7 directory.

Anything I can do?

sarahsturgeon avatar May 30 '18 21:05 sarahsturgeon

I resolved by doing:

brew reinstall vim --with-python@2

from https://github.com/vim/vim/issues/3117

nzambello avatar Jul 02 '18 10:07 nzambello

Glad that worked out for you!

Unfortunately I'm on Ubuntu and need to compile vim with python3 support. Hopefully a similarly easy solution comes up for this situation.

sarahsturgeon avatar Jul 02 '18 17:07 sarahsturgeon

So am I!

It seems that it is just a package rename problem (using importlib).

But the problem is not knowing where the python import code locates.

I had try to run ack imp in MatchTagAlways's home directory, but cannot find somewhere using imp package

RanchoCooper avatar Jul 03 '18 10:07 RanchoCooper

I think it's something deeper than that..

Line 28, which errors, is part of this block of code:

 19 let s:script_folder_path = escape( expand( '<sfile>:p:h' ), '\' )
 20 if has('python')
 21     " Python 2
 22     py import sys
 23     py import vim
 24     exe 'python sys.path = sys.path + ["' . s:script_folder_path . '/../python"]'
 25     py import mta_vim
 26 else
 27     " Python 3
 28     py3 import sys
 29     py3 import vim
 30     exe 'python3 sys.path = sys.path + ["' . s:script_folder_path . '/../python"]'
 31     py3 import mta_vim
 32 endif

Yeah I think this is out of my hands here, it's using python3 as expected, but it's actually something to do with py3 import it seems.

It'd probably be helpful if we pasted our vim --versions here, but I've recompiled since I made this issue and don't use this package anymore, so mine isn't very relevant anymore :(

sarahsturgeon avatar Jul 03 '18 16:07 sarahsturgeon

Agree with I think it's something deeper than that.. @brandonsturgeon

I had try ommit MatchTagAlways plug, and then restart vim, this infomation comes again. So my judgment is that the problem is in some basic code, and then it affects the normal operation of most plugins.

RanchoCooper avatar Jul 04 '18 03:07 RanchoCooper

see also

RanchoCooper avatar Jul 04 '18 03:07 RanchoCooper

Regardless of installed plugins, silently execute python3 once on the top of your vimrc:

if has('python3')
  silent! python3 1
endif

RanchoCooper avatar Jul 13 '18 06:07 RanchoCooper