sublime-text-2のpylinter使ててFatal errorとか出たので応急処置メモ

sublimetext2使ってるpythonistの人で
pylinter使ってる人とか多い気がするけどきっと、
ぼくも使ってたけどエラー出て動かんくなったから、
とりあえず応急処置して動いた!までやったことメモ。

とりあえずsublime text 2上でpylintが走った瞬間、
以下のお怒りの文言が表示される

Fatal pylint error:
pylint.utils.UnknownMessage: No such message id C0303


ググっても解決法を探しきれず、
とりあえずpylintを最新にupdate
→さらに動かんくなった。\(^o^)/

無謀にもエラーを読み解いてみる。

pylint.utils.UnknownMessage

…未知のメッセージ…だと…!?

とりあえずpylintのファイルをあさる。
(自分のpythonまでのパス)/pylint/utils.py
↑このファイルに、こんなclass発見
class UnknownMessage(Exception):

そして、このclassの中身は
"""raised when a unregistered message id is encountered"""

↑このコメント1行だけ。\(^o^)/

いやしかし!つまりは C0303 がないの?
またファイルをあさる。

(自分のpythonまでのパス)/pylint/checkers/format.py
↑このファイルのMSGSって辞書に、っぽいキーが並んでる!
そしてC0303 が無い!

ネット上で該当ファイルと、C0303をあさり、どっかから、
C0303の部分を拾ってきて貼り付け。

んで、sublimetext再起動したらpylint動いた!


いや、いつ消えたんか何故消えたんかわからんけど、
とりあえず動いたし、まぁええか。


とりあえず、ぼくが拾ってきた format.py の中のMSGS辞書は、
これやけど、最新のじゃないかもしれんし、まぁまぁ、
これの一部を自分のローカルのpylintのファイルにコピペして、
エラー治ったーとか、ちょっとどうかと思うし、
よい子のみんなはマネしないように気をつけて

MSGS = {
'C0301': ('Line too long (%s/%s)',
'line-too-long',
'Used when a line is longer than a given number of characters.'),
'C0302': ('Too many lines in module (%s)', # was W0302
'too-many-lines',
'Used when a module has too much lines, reducing its readability.'
),
'C0303': ('Trailing whitespace',
'trailing-whitespace',
'Used when there is whitespace between the end of a line and the '
'newline.'),
'C0304': ('Final newline missing',
'missing-final-newline',
'Used when the last line in a file is missing a newline.'),
'W0311': ('Bad indentation. Found %s %s, expected %s',
'bad-indentation',
'Used when an unexpected number of indentation\'s tabulations or '
'spaces has been found.'),
'W0312': ('Found indentation with %ss instead of %ss',
'mixed-indentation',
'Used when there are some mixed tabs and spaces in a module.'),
'W0301': ('Unnecessary semicolon', # was W0106
'unnecessary-semicolon',
'Used when a statement is ended by a semi-colon (";"), which \
isn\'t necessary (that\'s python, not C ;).'),
'C0321': ('More than one statement on a single line',
'multiple-statements',
'Used when more than on statement are found on the same line.',
{'scope': WarningScope.NODE}),
'C0322': ('Operator not preceded by a space\n%s',
'no-space-before-operator',
'Used when one of the following operator (!= | <= | == | >= | < '
'| > | = | \\+= | -= | \\*= | /= | %) is not preceded by a space.',
{'scope': WarningScope.NODE}),
'C0323': ('Operator not followed by a space\n%s',
'no-space-after-operator',
'Used when one of the following operator (!= | <= | == | >= | < '
'| > | = | \\+= | -= | \\*= | /= | %) is not followed by a space.',
{'scope': WarningScope.NODE}),
'C0324': ('Comma not followed by a space\n%s',
'no-space-after-comma',
'Used when a comma (",") is not followed by a space.',
{'scope': WarningScope.NODE}),
}

0 件のコメント :

コメントを投稿