Do python files need to be on the same drive as the plugin Python-mode for its functionality to work

StackOverflow https://stackoverflow.com/questions/17649225

  •  03-06-2022
  •  | 
  •  

Question

I'm using the plugin python-mode for gVim on a windows machine.

I have the following python-mode specific settings in my vimrc file:

"------------------------------------------------------------
" settings for Python-mode
" "-----------------------------------------------------------
map <Leader>g :call RopeGotoDefinition()<CR>
let ropevim_enable_shortcuts = 1
let g:pymode_rope_goto_def_newwin = "vnew"
let g:pymode_rope_extended_complete = 1
let g:pymode_breakpoint = 0
let g:pymode_syntax = 1
let g:pymode_syntax_builtin_objs = 0
let g:pymode_syntax_builtin_funcs = 0
map <Leader>b Oimport ipdb; ipdb.set_trace() # BREAKPOINT<C-c>

"Better navigating through omnicomplete option list
set completeopt=longest,menuone
function! OmniPopup(action)
    if pumvisible()
        if a:action == 'j'
            return "\<C-N>"
        elseif a:action == 'k'
            return "\<C-P>"
        endif
    endif
        return a:action
endfunction

inoremap <silent><C-j> <C-R>=OmniPopup('j')<CR>
inoremap <silent><C-k> <C-R>=OmniPopup('k')<CR>

These were suggested in this tutorial.

vimrc is on my M: drive.

Now if I open vim (set to open in the M: drive) and then open a python file on say the P: drive and then try to save that file I get the following error message:

enter image description here

If I move the file pi.py to the M: drive then everything is happy but surely to use files in vim it shouldn't be a condition that the file being edited is on the same drive as vim?

Can I change my settings for Python-mode to function on files from other drives?


EDIT Python-mode has the following setting which looks promising:

" Additional python paths
let g:pymode_paths = []

So in vimrc I've added

let g:pymode_paths = ['P:\Comp Apps\Python\']

But still if I open a .py file from that location i get the same error message.

Was it helpful?

Solution

If I execute :lcd %:p:h then the python-mode plugin seems to be working. I can also use set autochdir in my vimrc: not sure if there are any disadvantages to using this setting.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top