Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialVictor Curtis Jr
5,268 PointsFlake8 Program Still Finds Errors when There Appears to be None
I'm following the video for badpep8.py
and the errors appear to be cleared out but flake8
appears to be finding more errors. Not sure why this is happening?
# multiple imports
def foo_bar(arg1, arg2, arg3, arg4):
# way too much indentation
return arg1, arg2, arg3, arg4
def bar(*args):
# bad spacing
return 2 + 2
# Bad class name, bad spacing, bad indentation
class Treehouse:
def one(self):
return 1
def two(self):
return 2
# bad identation and whitespace
alpha, beta, charlie, delta = foo_bar(
"a long string",
"a longer string",
"yet another long string",
"and other crazy string"
)
# bad spacing
one = 1
three = 3
fourteen = 14 # make fourteen equal to 12
print(alpha)
print(fourteen)
print(Treehouse().two())
This is what prints to the console:
treehouse:~/workspace$ flake8 badpep8.py
/usr/local/lib/python3.9/site-packages/pep8.py:110: FutureWarning: Possible nested set at position 1
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
badpep8.py:6:1: E302 expected 2 blank lines, found 1
badpep8.py:11:1: E302 expected 2 blank lines, found 1
badpep8.py:14:1: W293 blank line contains whitespace
badpep8.py:21:21: W291 trailing whitespace
badpep8.py:22:23: W291 trailing whitespace
badpep8.py:36:1: W391 blank line at end of file
2 Answers
Andy McDonald
Python Development Techdegree Graduate 13,801 PointsThose should be relatively easy to pass with the description and good ol' fashioned trial and error. I think one of the first things you should do is delete all the comments. I think that's going to help you clear up some of that whitespace that it is not liking.
Victor Curtis Jr
5,268 PointsWell I kinda figured most of it out. There can be trailing white space and indented white space. It's sometimes about going line by line and getting rid of each.