Add this to vimrc. If there is a date string or something, it may be called ErrorFormat, so limit it only when the python file is executed by autocmd.
augroup ErrorFormat
    autocmd BufNewFile,BufRead *.py
        \ set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
augroup END
        Recommended Posts