Take the 2-minute tour ×

I'm trying to debug a fairly complex django project that obviously has a ton of calls to built in functions, other classes, and misc custom methods. What I want to do is put the pdb.set_trace() in just the file I am concerned with (ie. the value of a product) and when I do a step command in PDB, have it just go the other functions I'm calling within that file. I don't want it to go to any other file, django method, or python low level code.

Is this possible?

As a note I'm already using the amazing pdb++.

share|improve this question

1 Answer 1

Certainly. Just put the set_trace() call in that module, and if needed, add additional breakpoints using the b command for the other functions, or use multiple set_trace() calls.

Then, when stepping through the code, use n (or next) to skip over function calls that would take you out of the module. Or use unt (until) to run code until the next line is being executed (use this to get out of a long loop). Whenever the interpreter hits one of your breakpoints or set_trace() calls it'll stop there, regardless.

share|improve this answer

Your Answer


