visual-studio-codepylintpylintrc

Default pylintrc completely disables pylint


All I want to do is use the generated-members= line to disable the false "no-members" errors for several packages.

So, in the VS Code terminal, in my project root directory, I run:

pylint --generate-rcfile > .pylintrc

All linting warnings immediately disappear, even before I've change anything in the rc file. The only way I've been able to bring them back is by deleting .pylintrc. What am I doing wrong?


Solution

  • I was able to diagnose the problem and find a workaround. The issue was that the rcfile was being generated in the wrong encoding. Running pylint mymodule gave the following error:

    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
    

    as described here.

    I did not find a way to make pylint generate the config file in the correct encoding, but as a workaround, I just opened the .pylintrc file in Notepad++, changed the encoding to UTF-8 there, and then saved the file. After that, the .pylintrc file stays in the correct encoding even with subsequent edits in VS Code, allowing linting to work properly.