Pylint does not work in visual studio code
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Cool Puzzler LoFi
--
Chapters
00:00 Pylint Does Not Work In Visual Studio Code
01:50 Answer 1 Score 5
02:22 Accepted Answer Score 9
02:40 Answer 3 Score 1
03:30 Thank you
--
Full question
https://stackoverflow.com/questions/4378...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #visualstudiocode #pylint
#avk47
ACCEPTED ANSWER
Score 9
I have the same issue in Windows, and I get pylintrc file by:
pylint --generate-rcfile > ~/.pylintrc
While I use notepad++ to open it, the encoding is not utf8, and I change it to utf8, then it works.
ANSWER 2
Score 5
By now I've solved the problem by just using a copy of my pylintrc file from mac. The problem - as far as I understand it - comes from the Windows Powershell. When I do
pylint --generate-rcfile > pylintrc
it creates a file with cp-1251 encoding.
The solution is to copy the data and paste it into an IDE/text editor to save it as utf-8 file. Or simply (like I did) copy it from another system or from the web.
ANSWER 3
Score 1
What I observe, with my pylint 2.4.4 and VS Code 1.43.0 at least, is that pylint is irrespective to its' ~/.pylintrc file encoding. I tried it with quite a few encodings (far not only UTF8-BOM, UTF8-noBOM, but few others) - none of them caused it to fail.
The problem, discussed here, in my case was caused that I did not escaped slashes in ~/.pylintrc file [MASTER] section, when defining an init_hook it it.
I had:
[MASTER]
# other statements
...
init-hook="import sys; sys.path.append('C:\Users\<username>\Documents\<project>')"
and that caused the problem exactly like discussed here.
Once I added a r modifier before the path, like this:
[MASTER]
# other statements
...
init-hook="import sys; sys.path.append(r'C:\Users\<username>\Documents\<project>')"
it fixed the problem right away.