1

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?

Tristan Brown
  • 561
  • 5
  • 10

2 Answers2

1

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.

Tristan Brown
  • 561
  • 5
  • 10
0

I found a solution that worked for my Windows PC.

I installed a Linux VM, where I configured PyCharm and Pylint. Then, I created a GitHub repository to upload .pylintrc file on the Linux VM. Finally, I downloaded on Windows the .pylintrc file from the repository and I specified the path to this file in the configuration of Pylint.

It worked, even after making changes to .pylintrc. The main bug I encountered was that sometimes (when running Pylint) it would use a previous version of .pylintrc, instead of the current one, but it can be fixed by restarting Pycharm.