Microsoft Windows 10 Pro,1703,64-bit
pip install pylintThere is no other python on the system. have tried reinstalling.
位 pylint
Traceback (most recent call last):
File "c:\dist\python\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\dist\python\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\dist\python\Scripts\pylint.exe\__main__.py", line 9, in <module>
File "c:\dist\python\lib\site-packages\pylint\__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "c:\dist\python\lib\site-packages\pylint\lint.py", line 1254, in __init__
linter.read_config_file()
File "c:\dist\python\lib\site-packages\pylint\config.py", line 635, in read_config_file
parser.readfp(fp)
File "c:\dist\python\lib\configparser.py", line 763, in readfp
self.read_file(fp, source=filename)
File "c:\dist\python\lib\configparser.py", line 718, in read_file
self._read(f, source)
File "c:\dist\python\lib\configparser.py", line 1015, in _read
for lineno, line in enumerate(fp, start=1):
File "c:\dist\python\lib\codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
File "c:\dist\python\lib\encodings\utf_8_sig.py", line 69, in _buffer_decode
return codecs.utf_8_decode(input, errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
it is the same in powershell, any other python program works fine
Could it be some python2/python3 and utf-8 missmatch?
Works fine in windows bash (ubuntu 16.04):
$ pylint --version
No config file found, using default configuration
pylint 1.7.2,
astroid 1.5.3
Python 3.6.2 (default, Aug 8 2017, 09:25:03)
[GCC 5.4.0 20160609]
位 pip freeze | findstr "pylint"
pylint==1.7.2
位 pip3 install pylint
Requirement already satisfied: pylint in c:\dist\python\lib\site-packages
Requirement already satisfied: six in c:\dist\python\lib\site-packages (from pylint)
Requirement already satisfied: isort>=4.2.5 in c:\dist\python\lib\site-packages (from pylint)
Requirement already satisfied: astroid>=1.5.1 in c:\dist\python\lib\site-packages (from pylint)
Requirement already satisfied: colorama; sys_platform == "win32" in c:\dist\python\lib\site-packages (from pylint)
Requirement already satisfied: mccabe in c:\dist\python\lib\site-packages (from pylint)
Requirement already satisfied: lazy-object-proxy in c:\dist\python\lib\site-packages (from astroid>=1.5.1->pylint)
Requirement already satisfied: wrapt in c:\dist\python\lib\site-packages (from astroid>=1.5.1->pylint)
I see that you are using a different encoding that the usual one, can you get the output of chcp? Unfortunately pylint is mostly UTF-8 based, so having a less than usual encoding might trip it up.
Looks like it's an exception from reading pylintrc file. Do you have matching file somewhere in your env?
In PowerShell session on Windows 10 command
pylint --generate-rcfile > $HOME/.pylintrc
produce .pylintrc file with UTF16 encoding, and cause aforementioned problem
For now I'll close it as not a bug - since we do not support non-standard encodings in rcfile _right now_.
I'm not sure whether pylint _eventually_ is supposed to support non-ascii / non-utf8 rc files. To be determined...
run chcp 65001
before run pip install pylint
in cmd or powershell.
solved this issue with my win10.
chcp 65001 && pip install pylint && chcp 866 && pip install pylint
I encountered this bug when generating the .pylintrc file as described by @sldsrg (done in Windows 10, in the VS Code Powershell terminal). The chcp 65001 solution did not work for me.
I was able to fix it by opening my .pylintrc file in Notepad++, choosing the UTF-8 encoding there, and then saving the file. After that, the .pylintrc file remains in the proper format while editing and saving in VS Code.
You can specify the encoding in PowerShell with Out-File:
pylint --generate-rcfile | Out-File -Encoding utf8 .pylintrc
Most helpful comment
run chcp 65001
before run pip install pylint
in cmd or powershell.
solved this issue with my win10.