vim-syntastic / syntastic

Syntax checking hacks for vim
Do What The F*ck You Want To Public License
11.3k stars 1.14k forks source link

Python checkers do not work with macvim #1130

Closed aj8k closed 10 years ago

aj8k commented 10 years ago

Hi! Syntax checking does not work for me at all. Vim 7.4, pylint 1.2.1 Turned on in vimrc let g:syntastic_python_checkers = ['pylint'] Output of :SyntasticInfo

Syntastic: active mode enabled
Syntastic version: 3.4.0-92
Info for filetype: python
Available checker(s): pylint python
Currently enabled checker(s): pylint

But no errors appeared after saving file or manual check run. Here is output of direct pylint check:

$ pylint one.py
No config file found, using default configuration
************* Module 123.one
C:  1, 0: Missing module docstring (missing-docstring)
E:  3, 0: Module 'zmq' has no 'nononon' member (no-member)
C:  4, 0: Missing function docstring (missing-docstring)
W:  5, 4: Statement seems to have no effect (pointless-statement)
E:  5, 4: Undefined variable 'sf' (undefined-variable)
lcd047 commented 10 years ago

Please open a Python file, set g:syntastic_debug to 3, run the checker, and post the output of :mes.

aj8k commented 10 years ago

Sorry for delay. Here is output:

Messages maintainer: Bram Moolenaar <Bram@vim.org>
"one.py" 5L, 45C
syntastic: 1.932635: g:syntastic_version = '3.4.0-92'
syntastic: 1.932896: &shell = '/bin/bash', &shellcmdflag = '-c', &shellpipe = '2>&1| tee', &shellquote = '', &shellredir = '>%s 2>&1', &shellslash = 0, &shelltemp = 1, &shellxquo
te = '', &shellxescape = ''
syntastic: 1.933359: g:syntastic_aggregate_errors = 0
syntastic: 1.933619: getcwd() = /Users/ajoy/Work
syntastic: 2.160336: CacheErrors: Invoking checker: python/pylint
syntastic: 2.162264: SyntasticMake: called with options: {'errorformat': '%A%f:%l:%c:%t: %m,%A%f:%l: %m,%A%f:(%l): %m,%-Z%p^%.%#,%-G%.%#', 'makeprg': 'TERM=dumb pylint -f text --
msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" -r n one.py', 'returns': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25
, 26, 27, 28, 29, 30, 31]}
syntastic: 2.391039: checker output: ['No config file found, using default configuration', '************* Module one', 'Traceback (most recent call last):', '  File "/usr/local/b
in/pylint", line 9, in <module>', '    load_entry_point(''pylint==1.2.1'', ''console_scripts'', ''pylint'')()', '  File "/usr/local/lib/python2.7/site-packages/pylint/__init__.py
", line 21, in run_pylint', '    Run(sys.argv[1:])', '  File "/usr/local/lib/python2.7/site-packages/pylint/lint.py", line 1051, in __init__', '    linter.check(args)', '  File "
/usr/local/lib/python2.7/site-packages/pylint/lint.py", line 626, in check', '    self.check_astroid_module(astroid, walker, rawcheckers, tokencheckers)', '  File "/usr/local/lib
/python2.7/site-packages/pylint/lint.py", line 712, in check_astroid_module', '    walker.walk(astroid)', '  File "/usr/local/lib/python2.7/site-packages/pylint/utils.py", line 7
12, in walk', '    cb(astroid)', '  File "/usr/local/lib/python2.7/site-packages/pylint/checkers/base.py", line 1047, in visit_module', '    self._check_docstring(''module'', nod
e)', '  File "/usr/local/lib/python2.7/site-packages/pylint/checkers/base.py", line 1085, in _check_docstring', '    self.add_message(''missing-docstring'', node=node, args=(node
_type,))', '  File "/usr/local/lib/python2.7/site-packages/pylint/checkers/__init__.py", line 97, in add_message', '    self.linter.add_message(msg_id, line, node, args)', '  Fil
e "/usr/local/lib/python2.7/site-packages/pylint/utils.py", line 461, in add_message', '    self.reporter.add_message(msgid, (path, module, obj, line or 1, col_offset or 0), msg)
', '  File "/usr/local/lib/python2.7/site-packages/pylint/reporters/text.py", line 60, in add_message', '    self.write_message(m)', '  File "/usr/local/lib/python2.7/site-packag
es/pylint/reporters/text.py", line 49, in write_message', '    self.writeln(msg.format(self._template))', '  File "/usr/local/lib/python2.7/site-packages/pylint/reporters/__init_
_.py", line 112, in writeln', '    print >> self.out, self.encode(string)', '  File "/usr/local/lib/python2.7/site-packages/pylint/reporters/__init__.py", line 102, in encode', '
    locale.getdefaultlocale()[1] or', '  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 543, in getdefaultlocale', '
    return _parse_localename(localename)', '  File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 475, in _parse_localena
me', '    raise ValueError, ''unknown locale: %s'' % localename', 'ValueError: unknown locale: UTF-8', '']
syntastic: 2.395190: raw loclist: []
syntastic: 2.395513: getLocList: checker python/pylint returned 1
syntastic: 2.395694: python/pylint raw: []
syntastic: 2.395936: quiet_messages filter: {}
syntastic: 2.396361: aggregated: {'_name': '', '_rawLoclist': [], '_owner': 1}
lcd047 commented 10 years ago

' File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 475, in _parse_localename', ' raise ValueError, ''unknown locale: %s'' % localename', 'ValueError: unknown locale: UTF-8'

Your pylint crashes.

aj8k commented 10 years ago

Thanx for helping in diagnostic. Find solution by simple googling. Can be found by next link: http://patrick.arminio.info/blog/2012/02/fix-valueerror-unknown-locale-utf8/

To cut a long story short I just added next lines to ~/.bash_profile and that helps ('en_US.UTF-8' is my locale):

export LC_COLLATE="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export LC_MESSAGES="en_US.UTF-8"
export LC_MONETARY="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
export LC_TIME="en_US.UTF-8"
export LC_ALL=