(Windows7-64bits-Vim8.1) I have a problem with getting the python in Vim to work. This problem is probably caused because I do not have admin access to the machine; I can't help that.

In order to narrow down the problem, I got it down to a one line cmd script that does work when double clicked, but not when started from DOS. The script is:

<path to my home>\bin\Vim\vim81\gvim.exe

If I start this by double clicking, I get a perfectly fine gvim window, and it allows me to say

:py3 print("Hello")

Now if I start the very same file from DOS, it doesn't work: the same command :py print("Hello") gives E370 and E263. The same works for every other way I could think of to start vim from DOS: starting from different directories, using start, using cmd, even using it with %edit in IPython.

I checked all environment variables, I checked the startup sequence of Vim, but I cannot see any difference. Except for the fact that Python3 works in only one of the cases. By the way: my _vimrc (which is run in both cases) does modify pythonthreedll to the proper value, because I cannot get python in the registry. What is going on? I am getting mad...

  • are you sure, it is the same gvim? Check the output of :version and :echo v:progpath Mar 25 '19 at 16:17
  • Yep, they give pixel-perfect identical information. The only difference I can see is the result of :py3 print; that is <nothing> versus <E370> and <E263>. However, inspired by this I just found something else that is different :echo $PATH gives different output. So now all I have to do is finding the proper entry in $PATH that does the job. Thanks for the hint!
    – Jurjen Bos
    Mar 26 '19 at 12:27
  • I narrowed it down completely: even though I explicitly set the pythonthreedll variable, and the pythonthreehome, I still need to have python3 home dir in my $PATH. Weird. Looks like a bug to me.
    – Jurjen Bos
    Mar 26 '19 at 12:42
  • That is perfectly reasonable to need python in your $PATH, don't think this is a bug. Mar 26 '19 at 12:49
  • After trying out every possibility, I found that the setting of pythonthreehome has no effect, while $PATH does. Why is there a pythonthreehome then?
    – Jurjen Bos
    Mar 26 '19 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.