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

Python Write Better Python Buggy Logs PDB

Import PDB and call set_trace() where it's needed. Can't get past this, please help

where am I getting it wrong

starter.py
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
STAFF
Kenneth Love
Treehouse Guest Teacher

Your code gives me an indentation error. It's really badly indented. Make sure that the indentation is correct for Python code.

I have been trying to correct the indentation Kenneth but am failing to find where I am getting it all wrong

I have been trying to correct the indentation Kenneth but am failing to find where I am getting it all wrong

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

The 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?

import 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
Eleeza Amin
34,496 Points

Could you use Markdown to format code?