Unintentional trailing comma that creates a tuple

pylintalready detects this as a problem (as of version 1.7). For example, here’s my tuple.py: “””Module docstring to satisfy pylint””” def main(): “””The main function””” thing = 1, print(type(thing)) if __name__ == “__main__”: main() $ pylint tuple.py No config file found, using default configuration ************* Module tuple R: 5, 0: Disallow trailing comma tuple (trailing-comma-tuple) … Read more

How do I create a pylintrc file

You may put it in: /etc/pylintrc for default global configuration ~/.pylintrc for default user configuration <your project>/pylintrc for default project configuration (used when you’ll run pylint <your project>) wherever you want, then use pylint –rcfile=<wherever I want> Also notice when generating the rc file, you may add option on the command line before the –generate-rcfile, … Read more

How do I disable a Pylint warning?

pylint –generate-rcfile shows it like this: [MESSAGES CONTROL] # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option # multiple time. #enable= # Disable the message, report, category or checker with the given id(s). You # can either … Read more

Why does it say that module pygame has no init member?

Summarizing all answers. This is a security measure to not load non-default C extensions. You can white-list specific extension(s). Open user settings and add the following between {}: “python.linting.pylintArgs”: [ “–extension-pkg-whitelist=extensionname” // comma separated ] You can allow to “unsafe load” all extensions. Open user settings and add the following between {}: “python.linting.pylintArgs”: [ “–unsafe-load-any-extension=y” … Read more

PyLint “Unable to import” error – how to set PYTHONPATH?

There are two options I’m aware of. One, change the PYTHONPATH environment variable to include the directory above your module. Alternatively, edit ~/.pylintrc to include the directory above your module, like this: [MASTER] init-hook=’import sys; sys.path.append(“/path/to/root”)’ (Or in other version of pylint, the init-hook requires you to change [General] to [MASTER]) Both of these options … Read more