vim+syntastic+pyflakes fails on Windows 10, works on Linuxes

124 views Asked by At

I've got my vim configs stored in subversion, at https://stromberg.dnsalias.org/svn/vimrc/trunk

I use it frequently on linuxes. It works great for editing Python code; I use pyflakes, pydocstyle and pycodestyle.

I am doing a Windows+Linux project lately, so I wanted to use this vim config on Windows 10 too. It does pydocstyle and pycodestyle well, but pyflakes is ignored for some reason, even if I intentionally put in something I know pyflakes should complain about - but as I mentioned, pyflakes only fails on Windows, not Linux. And I want to use pyflakes on Windows.

I've been staring at this for hours, but I'm not seeing why pyflakes fails when pydocstyle and pycodestyle are happy.

If I run: python3 -m pyflakes t.py ...at the command line, things seem to work fine, even on Windows 10. There are errors caught, and the exit code is 1.

Here's my t.py:

#!/usr/bin/env python3

"""Scrutinize how pyflakes is working."""


def main():
    """Scrutinize how pyflakes is working"""
    fred = 1
    print('hi')
    print(barney)


main()

I tried export LC_CTYPE=en_US.UTF-8 ...in an MSYS bash, prior to editing t.py. The errors from pyflakes were still ignored.

I also tried enabling syntastic debugging, with:

let g:syntastic_debug_file = "~/syntastic.log"
let g:syntastic_debug = 3

...in my ~/_vimrc (the name is changed on Windows).

This results in the following in ~/syntastic.log:

syntastic: 15032.879527: g:syntastic_version = '3.9.0-20 (Vim 802, Windows, GUI)'
syntastic: 15032.884153: &shell = 'c:\windows\system32\cmd.exe', &shellcmdflag = '/c', &shellpipe = '>%s 2>&1', &shellquote = '', &shellredir = '>%s 2>&1', &shelltemp = 1, &shellxquote = '(', &autochdir = 0, &shellslash = 0, &shellxescape
 = '"&|<>()@^'
syntastic: 15032.889707: UpdateErrors (auto): default checkers
syntastic: 15032.893923: CacheErrors: default checkers
syntastic: 15032.898643: g:syntastic_aggregate_errors = 0
syntastic: 15032.901642: getcwd() = 'C:\Users\strom\src\orange-med\NKV-Gateway'
syntastic: 15032.905103: CacheErrors: Invoking checker: python/pyflakes
syntastic: 15032.910677: SyntasticMake: called with options: {'errorformat': '%E%f:%l: could not compile,%-Z%p^,%E%f:%l:%c: %m,%E%f:%l: %m,%-G%.%#', 'defaults': {'text': 'Syntax error'}, 'makeprg': 'pyflakes t.py', 'env': {}}
syntastic: 15035.560459: system: command run in 2.646106s
syntastic: 15035.563594: checker output: ['t.py:8:5 local variable ''fred'' is assigned to but never used', 't.py:10:11 undefined name ''barney''', '']
syntastic: 15035.566310: raw loclist: []
syntastic: 15035.569032: getLocList: checker python/pyflakes returned 1
syntastic: 15035.571879: python/pyflakes raw: []
syntastic: 15035.576068: quiet_messages filter: {}
syntastic: 15035.578621: getLocList: checker python/pyflakes run in 2.668662s
syntastic: 15035.581320: CacheErrors: Invoking checker: python/pycodestyle
syntastic: 15035.584226: SyntasticMake: called with options: {'subtype': 'Style', 'errorformat': '%f:%l:%c: %m', 'makeprg': 'pycodestyle t.py --max-line-len=131', 'env': {}}
syntastic: 15035.992649: system: command run in 0.404938s
syntastic: 15035.996063: checker output: ['']
syntastic: 15035.998649: raw loclist: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'module': '', 'type': '', 'pattern': '', 'text': ''}]
syntastic: 15036.001299: getLocList: checker python/pycodestyle returned 0
syntastic: 15036.003611: python/pycodestyle raw: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'E', 'pattern': '', 'subtype': 'Style', 'text': ''}]
syntastic: 15036.006282: quiet_messages filter: {}
syntastic: 15036.008859: getLocList: checker python/pycodestyle run in 0.425115s
syntastic: 15036.011522: CacheErrors: Invoking checker: python/pydocstyle
syntastic: 15036.014535: SyntasticMake: called with options: {'subtype': 'Style', 'postprocess': ['compressWhitespace'], 'preprocess': 'killEmpty', 'errorformat': '%E%f:%l %.%#:,%+C        %m', 'makeprg': 'pydocstyle t.py --match=".*"', '
env': {}}
syntastic: 15036.945317: system: command run in 0.926581s
syntastic: 15036.948276: checker output: ['t.py:7 in public function `main`:', '        D400: First line should end with a period (not ''g'')', '']
syntastic: 15036.950823: preprocess: ['t.py:7 in public function `main`:', '        D400: First line should end with a period (not ''g'')']
syntastic: 15036.954283: raw loclist: [{'lnum': 7, 'bufnr': 1, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'E', 'pattern': '', 'text': '^@        D400: First line should end with a period (not ''g'')'}]
syntastic: 15036.957134: postprocess: [{'lnum': 7, 'bufnr': 1, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'E', 'pattern': '', 'subtype': 'Style', 'text': 'D400: First line should end with a period (not ''g'')'}]     
syntastic: 15036.959597: getLocList: checker python/pydocstyle returned 1
syntastic: 15036.961966: python/pydocstyle raw: [{'lnum': 7, 'bufnr': 1, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'E', 'pattern': '', 'subtype': 'Style', 'text': 'D400: First line should end with a period (not ''g'
')'}]
syntastic: 15036.965127: quiet_messages filter: {}
syntastic: 15036.967540: getLocList: checker python/pydocstyle run in 0.953626s
syntastic: 15036.971975: aggregated: {'_sorted': 0, '_name': 'pydocstyle (python)', '_owner': 1, '_columns': 1, '_rawLoclist': [{'lnum': 7, 'bufnr': 1, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'E', 'pattern': '', '
subtype': 'Style', 'text': 'D400: First line should end with a period (not ''g'')'}]}

...but even that doesn't appear to tell me what's wrong.

This is the point where, on Linux, I'd probably turn to strace.

BTW, the vimrc is at https://stromberg.dnsalias.org/svn/vimrc/trunk/hierarchy/.vimrc , and the most relevant portions are:

let g:syntastic_python_checkers = ['pyflakes', 'pycodestyle', 'pydocstyle']
function Py2()
  let g:syntastic_python_python_exec = '/usr/bin/python'
endfunction
function Py3()
  let g:syntastic_python_python_exec = '/usr/bin/python3'
endfunction
call Py3()   " default to Python3

BTW, I tried changing the /usr/bin/python3 to simply 'python3' in my ~/_vimrc, but it didn't appear to help.

Oh, and :SyntasticInfo gives:

Syntastic version: 3.9.0-20 (Vim 802, Windows, GUI)
Info for filetype: python
Global mode: active
Filetype python is active
The current file will be checked automatically
syntastic: 7.613563: system: command run in 0.175868s
Available checkers: pep257 pep8 pycodestyle pydocstyle pyflakes python
Currently enabled checkers: pyflakes pycodestyle pydocstyle
syntastic: 7.621995: &shell = 'c:\windows\system32\cmd.exe', &shellcmdflag = '/c', &shellpipe = '>%s 2>&1', &shellquote = '', &shellredir = '>%s 2>&1', &shelltemp = 1, &shellxquote = '(', &autochdir = 0, &shellslash = 0, &shellxescape = '
"&|<>()@^'

Any suggestions folks?

0

There are 0 answers