how to fix the "W293 blank line contains whitespace"
my python code produce the following warning message:
how do you fix the issue?
3 Answers 3
Using the same principal from this question, you can use autopep8 to automatically fix these. The syntax is .
![]()
Simply delete the spaces, tabs, or other white space characters from line 8 in file.py.
Blank lines should not contain any tabs or spaces. So remove the extra spaces as per PEP8. Source — https://ayush-raj-blogs.hashnode.dev/making-clean-pr-for-open-source-contributors-pep-8-style
-
The Overflow Blog
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.3.11.43304
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
W293 blank line contains whitespace что делать
I did check spaces and indentation, and it still give me errors.
1 Answer

Cory Madden
Cory Madden
Make sure to check the blank lines and make sure there aren’t any indents and that you have an empty new line at the end of the file. Otherwise, that looks good.
Posting to the forum is only allowed for members with active accounts.
Please sign in or sign up to post.
how to fix the «W293 blank line contains whitespace»
my python code produce the following warning message:
how do you fix the issue?
3 Answers 3
Using the same principal from this question, you can use autopep8 to automatically fix these. The syntax is .
![]()
Simply delete the spaces, tabs, or other white space characters from line 8 in file.py.
Blank lines should not contain any tabs or spaces. So remove the extra spaces as per PEP8. Source — https://ayush-raj-blogs.hashnode.dev/making-clean-pr-for-open-source-contributors-pep-8-style
Not the answer you’re looking for? Browse other questions tagged python flake8 or ask your own question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Site design / logo © 2022 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2022.6.10.42345
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Name already in use
Flake8Rules / _rules / W293.md
- Go to file T
- Go to line L
- Copy path
- Copy permalink
- Open with Desktop
- View raw
- Copy raw contents Copy raw contents
Copy raw contents
Copy raw contents
Blank lines should not contain any tabs or spaces.
Note: The • character represents a space.
Footer
© 2023 GitHub, Inc.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Making clean PR for Open Source Contributors ( PEP 8 Style )

Code runs on local Pycharm IDE but throws Pylint / Deepsource error on Github repo.
Are you new to open source contribution ? Does you code run on local machine but throws error(s) on making a PR (pull request) on some good GitHub repo? Then this article is for you. I have always had trouble in making a clean Pull Request on open source projects in python . And with time as the experience grew, it became even easier. Many Github repo with python follow PEP-8 style of coding. And a violation of these rules may throw some error which we neglect on local machine IDE.
We will broadly cover some of the error types in this article.
1. Use of global Statement
Anti Pattern It is recommended not to use global statement unless it is really necessary. Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs.
Fix- Create a basic read method, either as a class or a global function. Replace all reads with the access method, but leave the variable defined as a global. Review each of the writes to the method and extract action functions one at a time. Unless two operations are coded identically in the original code, extract each write access separately. Change the variable scope from global to local. Analyze similar action functions to determine if any can be merged, i.e., there are no functional differences in the results of the function, just differences in the implementation details. Review the calls to the read method and see if a more complex functionality should be applied. Follow the approach for writes and unless implementations are identical, create separate access functions. Analyze the access functions for duplication.
2. Imports
2.1 Multiple imports in one line (FLK-E401)
Imports should usually be on separate lines.
2.2 Module imported but unused PYL-W0611
Remove unused imports .

2.3 Unused import from wildcard import found PYL-W0614
In a wildcard import, all public names defined in the module are imported. It is advised to explicitly import the values needed or modify the module being imported from and define all to restrict the names to be imported.

3. Spaces
We will cover about idents and new line.
3.1 Bad indentation detected PYL-W0311
Style Statements use indentations that are not standard four spaces. PEP recommends 4 spaces to be used as a single indent.
3.2 Blank line contains whitespace FLK-W293
Blank lines should not contain any tabs or spaces.

3.3 Trailing whitespace detected FLK-W291
There should be no whitespace after the final character in a line.

After the final word , please change the line to fix it.
3.4 Unexpected spaces around keyword / parameter equals (E251)
There should be no spaces before or after the = in a function definition.
3.5 Missing whitespace around operator FLK-E225
There should be one space before and after all operators.
3.6 Missing whitespace after ‘,’, ‘;’, or ‘:’ (E231)
3.7 At least two spaces before inline comment FLK-E261
Inline comments should have two spaces before them. Often programmers will only include one space, which will trigger this warning.
3.8 Multiple blank lines detected at end of the file FLK-W391 / No newline at end of file FLK-W292
There should be one, and only one, blank line at the end of each file. This warning will occur when there are two or more blank lines.
3.9 Function , Classes and Blank Spaces
Top-level function and classes are separated by two blank lines. Method definitions inside classes should be separated by one blank line. In the example , the classes SwapTest and OddOrEvenTest are separated by two blank lines, whereas the method definitions, such as .setUpSwap() and .test_swap_operation() only have one blank line to separate them.
4 Unnecessary parentheses after keyword PYL-C0325
STYLE Extra parentheses in code can be removed for improved readability. In the examples below, the first example is more readable than the second one.
5 Line too long FLK-E501
Line length greater than configured max_line_length detected, defaults to 79 character. Real time issues and fixes.
Case 1 :
Break after «,» 
Case 2 :
Renaming folder comes to rescue 
Case 3 : While using the + operator, you can better use a proper line break, which makes your code easier to understand:
This is the first part of my tutorial on PEP-8 guidelines. I’m open to your suggestions.
Did you find this article valuable?
Support Ayush Raj by becoming a sponsor. Any amount is appreciated!