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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Amy Murphy](https://secure.gravatar.com/avatar/f99283131edd7fb9e87670699919d3bc?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Amy Murphy
6,172 PointsDoes anyone know what this error means?
I made all of the changes that Kenneth made to the badpep8.py file, but I'm getting one extra error that wasn't in the video.
Here's the code:
# 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())
When I run flake8 badpep8.py
in the console, I get the following message:
/usr/local/lib/python3.9/site-packages/pep8.py:110: FutureWarning: Possible nested set at position 1
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
Does anyone know what this is? Any help would be much appreciated! :)
3 Answers
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsHey Amy Murphy, the short answer is “whitespace found after an opening paren, square or curly bracket, or whitespace found before a paren, square or curly bracket, comma, semi-colon, or colon”
Looking at the call to foo_bar
the parens around the arguments have this whitespace before the first argument.
Longer answer, the regex is looking for two cases. Breaking down the regex;
r'[[({] | []}),;:]'
r'set1 with two cases'
r'[case1|case2]' # set1: case1 or case2
r'[({] ' # case1
r'set2 followed by space ‘ # case1
r'[({]' # set2: open paren, open curly bracket, or open
r' []}),;:]' # case2
r'space followed by set3' # case2
r'[]}),;:]' # set3: closing bracket, comma, semi-colon, or colon
![Amy Murphy](https://secure.gravatar.com/avatar/f99283131edd7fb9e87670699919d3bc?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Amy Murphy
6,172 PointsThanks, Chris! Any tips on how to resolve the issue?
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsI get this error running pep8
on your code:
Warning: Possible nested set at position 1
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
.../lib/python3.8/site-packages/pep8.py:2123: UserWarning:
pep8 has been renamed to pycodestyle (GitHub issue #466) # <<<
Use of the pep8 tool will be removed in a future release. # <<<
Please install and use `pycodestyle` instead. # <<<
Looking the whole error message, it looks like pep8
has be deprecated. The last version of pep8
was 1.7.1 (2017-10-22) where the deprecation warning was added. Using pycodestyle
is the new solution.
I have installed (python -m pip install pycodestyle
) and run pycodestyle locally on your code and it passes cleanly.
![Amy Murphy](https://secure.gravatar.com/avatar/f99283131edd7fb9e87670699919d3bc?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Amy Murphy
6,172 PointsThanks!
![Oscar Gomez](https://uploads.teamtreehouse.com/production/profile-photos/9667022/micro_IMG_5713.jpg)
Oscar Gomez
6,797 Points# import sys #unused
# import random #unused
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())
# import pep8
# checker = pep8.Checker('badpep8.py')
# checker.check_all()
![Oscar Gomez](https://uploads.teamtreehouse.com/production/profile-photos/9667022/micro_IMG_5713.jpg)
Oscar Gomez
6,797 Pointsgetting same error as Amy:
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'[[({] | []}),;:]')
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsSee comment above about installs pycodestyle
.
Post back if you need more help. Good luck!!!
Chris Freeman
Treehouse Moderator 68,425 PointsChris Freeman
Treehouse Moderator 68,425 PointsMarking as feedback.
Developers: Please add to Teacher's Notes:
The standard Workspace for this video might need updating as well.