Reputation: 439
my python code produce the following warning message:
(1) \dir\file.py:8:1 W293 blank lines contains whitespace
this comes after commands[0] flake8 XXX
how do you fix the issue?
Upvotes: 10
Views: 24366
Reputation: 33770
While in most cases it is best to just remove the extra whitespace from the lines, sometimes it is not possible. For example, when working with multiline strings where white space has some semantic meaning. Then, the best you can do is to add # noqa: W293
to the line which ends the string. For example:
my_long_txt = """
For some reason
whitespace required on empty line above
""" # noqa: W293
This tells linters to skip linting the entire string for the W293.
Upvotes: 1
Reputation: 662
Using the same principal from this question, you can use autopep8 to automatically fix these. The syntax is ...
autopep8 --select=W293 --in-place your_file.py
Upvotes: 17
Reputation: 11915
Simply delete the spaces, tabs, or other white space characters from line 8 in file.py.
Upvotes: 5