I have recently switched to vim from VS Code. I have Vim 8.2.
I have put these lines in my _vimrc file so that I can run python in vim by pressing
autocmd FileType python map <buffer> <F9> :w<CR>:exec '!py -3' shellescape(@%, 1)<CR> autocmd FileType python imap <buffer> <F9> <esc>:w<CR>:exec '!py -3' shellescape(@%, 1)<CR>
I have tried running a few python programs and all of them ran smoothly except one in which my program has to read a JSON file which is present in the same directory as that of the script, but the shell in vim tells me that it couldn't find that file. it says:-
FileNotFoundError: [Errno 2] No such file or directory: 'main_dic.json' shell returned 1
I run the same program on my Windows CMD and it works perfectly.
Why is this happening? How can I fix this?