Pylint-django raising error about Django not being configured when that’s not the case (VSCode)

Add the –django-settings-module argument the VS Code settings: { “python.linting.pylintArgs”: [ […] “–django-settings-module=<mainapp>.settings”, ] } Change <mainapp> to be your main app directory. For example, if your settings.py was in sweetstuff/settings.py then the argument value would be sweetstuff.settings. This is the same format as you would import the settings module from inside a Python module … Read more

pylint raises error if directory doesn’t contain __init__.py file

$ sw_vers ProductName: Mac OS X ProductVersion: 10.13.6 BuildVersion: 17G65 $ pylint –version pylint 2.1.1 astroid 2.0.3 Python 3.7.0 (default, Jul 23 2018, 20:22:55) [Clang 9.1.0 (clang-902.0.39.2)] Update I got this to work by trying: $ cd /app $ pylint *.py or try: $ pylint /path/to/app/*.py and got the whole thing working. … Report ====== … Read more

How do I disable pylint unused import error messages in vs code

As others have said, you can provide a disable argument to disable a specific message. I wanted to elaborate on that. Here is the syntax for disabling multiple messages and for providing multiple arguments, which was not immediately obvious to me from googling it: “python.linting.pylintArgs”: [ “–max-line-length=80”, “–disable=W0142,W0403,W0613,W0232,R0903,R0913,C0103,R0914,C0304,F0401,W0402,E1101,W0614,C0111,C0301” ] You stated that you started seeing … Read more

how to tell pylint to ignore certain imports?

Just run into this as well with the following code: 8: if os.name == ‘nt’: 9: import msvcrt 10: else: 11: import fcntl pylint failed the build with this error: E: 9, 4: Unable to import ‘msvcrt’ (import-error) The solution is available since pylint 0.10: 9: import msvcrt # pylint: disable=import-error

pylint false positive E0401 import errors in vscode while using venv

Pylint has some quirks. In this case it doesn’t know where to find your module because it’s in subdirectory of your venv path. To solve this: Put this setting in your workspace or folder settings: “python.linting.pylintArgs”: [ “–init-hook”, “import sys; sys.path.append(‘<path to folder your module is in>’)” ] or, maybe better Generate .pylintrc file. From … Read more

Automated docstring and comments spell check

Pylint includes a spell-checker since 1.4.0. Note that, to make the checker work, you need to install pyenchant python module and have an enchant library installed system-wide. On mac, it can be installed via brew: $ brew install enchant By default, the spelling pylint checker is turned off. You can enable it either in the … Read more

Pylint warning for “useless super delegation”

If you call the SpecificError class it will look for an __init__. If it doesn’t exist it will call the parent’s __init__. There is no need to add an __init__ here, since it’s exactly the same like the parent class. It is basically code duplication. You should do: class SpecificError(MyProjectExceptions): “””Raise when a specific error … Read more

Understanding “Too many ancestors” from pylint

The problem is that you inherit from a class which has itself (too) many ancestors: RegisterForm. In your case, you can’t do a lot about this, beside stopping using it which is probably not an option. So you may want to disable this message for this class, eg: class ExtendedRegisterForm(RegisterForm): # pylint: disable=too-many-ancestors