Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code doesn't recognize pep8

To use linting for Python, I configured VS Code like this:

"python.linting.enabled": true,
"python.linting.pylintEnabled": false,
"python.linting.pep8Enabled": true,
"python.linting.lintOnTextChange": true,
"python.linting.lintOnSave": true

Then I opened a *.py file and added an unnecessary space and saved, then I got an error: Linter pep8 is not installed.

But I already installed pep8. And by using VS Code console I can find the pep8.

With VS Code console

/usr/bin/python -m pip install pep8
loading ~/.zshrc_osx
ironsand@macbook ~ % /usr/bin/python -m pip install pep8
/usr/bin/python: No module named pip
ironsand@macbook ~ % which python
/usr/bin/python
ironsand@macbook ~ % which pep8
/usr/local/bin/pep8
ironsand@macbook ~ % pep8 --version
1.7.0
ironsand@macbook ~ % which python
/usr/bin/python
ironsand@macbook ~ %

Maybe I installed pep8 by using pip2 that is installed brew.

With OS Console(iTerm2)

python --version
Python 2.7.10
ironsand@macbook ~ % /usr/local/bin/pip2 install pep8
Collecting pep8
  Using cached pep8-1.7.0-py2.py3-none-any.whl
Installing collected packages: pep8
Successfully installed pep8-1.7.0

What am I doing wrong?

Plugins

MagicPython 1.0.12
Python 0.7.0
Python for VSCode 0.2.3
like image 426
ironsand Avatar asked Sep 02 '17 07:09

ironsand


People also ask

Is PEP8 deprecated?

Deprecated use of [pep8] section name in favor of [pycodestyle] ; #591.

Does pylint enforce PEP8?

By default, Pylint will enforce PEP8-suggested names.


1 Answers

The problem with pep8 is because vscode now is using flake8, is basically the same, pep8 was renamed to pycodestyle, flake8 use pycodestyle, this is the old config:

"python.linting.pep8Enabled": true, // Don't use it

But now you can't find that config in vscode, the new config line now is:

"python.linting.flake8Enabled": true, // This is the new config for pep8

If the second option didn't work, you can try this:

"python.linting.pycodestyleEnabled": true // You need: pip install pycodestyle

I hope this answer is helpful for you

like image 131
Roberth Solís Avatar answered Sep 22 '22 22:09

Roberth Solís