2
import argparse
from argparse import ArgumentParser
parser = ArgumentParser(description="Test Massage")

flake8 in vim accurate error

test.py|4 col 1 warning| [invalid-name] Invalid constant name "parser"

Liviu
  • 1,859
  • 2
  • 22
  • 48
Kevincpy
  • 21
  • 4
  • I think [this solution](https://github.com/PyCQA/pylint/issues/847) is more robust, more helpful, and better explains the issue than the answer given by @Liviu. – Mike Williamson May 02 '18 at 04:53
  • @Mike I mostly agree (helpful explanation, some solution), except I do not see the better solution since adding parameters to pylint everywhere is not really practical in my view ... Instead, could you kindly answer THIS question ? – Liviu May 02 '18 at 09:31

1 Answers1

0

I had the same error using Pylintand I solved it moving the assignment in a function (make a dedicated function to parse the command line). I guess it treats the module level variables as constants, like Pylint also does, because it doesn't make much sense to declare them there and it's much easier to apply a simple rule than to really detect if it is a constant.

Liviu
  • 1,859
  • 2
  • 22
  • 48
  • More here: http://stackoverflow.com/questions/1885251/how-do-i-tell-pylint-its-a-variable-not-a-constant-to-stop-message-c0103 (and the linked questions) – Liviu Oct 31 '14 at 13:31