davidhalter / jedi-vim

Using the jedi autocompletion library for VIM.
MIT License
5.27k stars 370 forks source link

"path is on mount %r, start on mount %r" exception thrown by os.path.relpath() on Windows when vim-jedi is installed on different drive than Python itself #1044

Closed Konstantin-Glukhov closed 3 years ago

Konstantin-Glukhov commented 3 years ago

Issue

On Windows with Python 3.9 if vim jedi is installed on different drive than Python itself, 'goto' function causes the exception _"path is on mount %r, start on mount %r"_thrown by os.path.relpath(path) on line 1115 in file pythonx/jedi_vim.py. This issue can be easily fixed by changing relpath() call to realpath().

Steps to reproduce

Install Python 3.9 to P:\Python\39 Install gvim8.2 (compiled with python 3.9) to P:\Vim Install vim jedi on drive E:\Vim\vimfiles\pack\misc\opt\jedi

set VIM=E:\Vim set VIMRUNTIME=P:\Vim\vim82

create E:\Vim\vimrc packadd jedi

open a python script with any call to some standard python library function and trigger 'goto' exception will be thrown as described in the issue

blueyed commented 3 years ago

Code ref: https://github.com/davidhalter/jedi-vim/blob/5d4615707fc7bce8a4f1fdaa5f7f07c11637bc30/pythonx/jedi_vim.py#L1115

There's a relpath helper that could/should be used here maybe: https://github.com/davidhalter/jedi-vim/blob/5d4615707fc7bce8a4f1fdaa5f7f07c11637bc30/pythonx/jedi_vim.py#L456-L461

@Konstantin-Glukhov Please consider patching it using that helper, testing it, and creating a PR then.

davidhalter commented 3 years ago

Fixed in #1045