How to disable a pep8 error in a specific file?

As far as I know, you can't. You can disable errors or warnings user wide, or per project. See the documentation.

Instead, you can use the # noqa comment at the end of a line, to skip that particular line (see patch 136). Of course, that would skip all PEP8 errors.

The main author argues against source file noise, so they suggested # pep8 comments don't get included.


Note that there is also nopep8, which is the equivalent. noqa (which stands for No Quality Assurance was added in version 1.4.1 to support people running pyflakes next to pep8.


Try putting # nopep8 at the end of the line (after two spaces). So if the line of code is:

h=1+2+3+4+5+6+func( "hello","world")

then to ignore the copious pep8 errors for that line it becomes:

h=1+2+3+4+5+6+func( "hello","world")  # nopep8

You can use --ignore flag to disable the error you mentioned above

pep8 --ignore=E223 file_name.py

for multiple errors

pep8 --ignore=E223,E501 file_name.py

For more in depth knowledge of other flags you can scan through http://pep8.readthedocs.org/en/latest/intro.html