I want to run a python program directly in vim. I type
:w !python
I get error
'no module named...' or 'no such file or directory: 'file.json''.
It occurs only when I load file after opening vim. When I start vim typing gvim filename.py, it works fine (:w !python works). What is wrong here?
file.json. Try starting vim when you're inside the same directory, load the file and do:w !python:cd %:hand then:w !python:w !python %. The percent sign%represents the current file open in vim. This is like calling:w !python /path/to/current/file.py