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 trialMZ140542 Edwin Chawabvunza
2,432 PointsImport PDB and call set_trace() where it's needed. Can't get past this, please help
where am I getting it wrong
def something_silly(arg1, arg2):
if len(arg1) > len(arg2):
import pdb
def test(what):
pdb.set_trace()
arg1[0] = arg2[0]
return arg1, arg2
3 Answers
Kenneth Love
Treehouse Guest TeacherYour code gives me an indentation error. It's really badly indented. Make sure that the indentation is correct for Python code.
MZ140542 Edwin Chawabvunza
2,432 PointsI have been trying to correct the indentation Kenneth but am failing to find where I am getting it all wrong
Kenneth Love
Treehouse Guest TeacherThe indentation isn't what's causing this to fail, but it's definitely a problem. Each indentation should be the same amount (if you indent with 4 spaces one place, you shouldn't indent with 2 somewhere else). You also stuck a function into the middle of another function (allowed, but unnecessary).
You need to import PDB and use it where the comment says. How do you import PDB? How do you use PDB like I showed in the video?
Annie Scott
27,613 Pointsimport pdb
def something_silly(arg1, arg2):
if len(arg1) > len(arg2):
# Import and use PDB here
pdb.set_trace()
arg1[0] = arg2[0]
return arg1, arg2
Eleeza Amin
34,496 PointsCould you use Markdown to format code?
MZ140542 Edwin Chawabvunza
2,432 PointsMZ140542 Edwin Chawabvunza
2,432 PointsI have been trying to correct the indentation Kenneth but am failing to find where I am getting it all wrong