pdb

What is the right way to debug in iPython notebook?

What is the right way to debug in iPython notebook? Question: As I know, %debug magic can do debug within one cell. However, I have function calls across multiple cells. For example, In[1]: def fun1(a) def fun2(b) # I want to set a breakpoint for the following line # return do_some_thing_about(b) return fun2(a) In[2]: import …

Total answers: 11

Docker-compose and pdb

Docker-compose and pdb Question: I see that I’m not the first one to ask the question but there was no clear answer to this: How to use pdb with docker-composer in Python development? When you ask uncle Google about django docker you get awesome docker-composer examples and tutorials and I have an environment working – …

Total answers: 4

Python-pdb skip code (as in "not execute")

Python-pdb skip code (as in "not execute") Question: Is there a way to skip a line or two altogether in pdb? Say I have a pdb session: > print 10 import pdb; pdb.set_trace() destroy_the_universe() # side effect useful_line() And I want to go straight to useful_line() WITHOUT invoking pdb() once again, or destroying the universe. …

Total answers: 1

Is it possible to step backwards in pdb?

Is it possible to step backwards in pdb? Question: After I hit n to evaluate a line, I want to go back and then hit s to step into that function if it failed. Is this possible? The docs say: j(ump) lineno Set the next line that will be executed. Only available in the bottom-most …

Total answers: 4

Attaching a process with pdb

Attaching a process with pdb Question: I have a python script that I suspect that there is a deadlock. I was trying to debug with pdb but if I go step by step it doesn’t get the deadlock, and by the output returned I can see that it’s not being hanged on the same iteration. …

Total answers: 4

How do I manipulate a variable whose name conflicts with PDB commands?

How do I manipulate a variable whose name conflicts with PDB commands? Question: My code is, for better or worse, rife with single letter variables (it’s physics stuff, so those letters are meaningful), as well as NumPy’s, which I’m often interacting with. When using the Python debugger, occasionally I’ll want to look at the value …

Total answers: 5

How to exit pdb and allow program to continue?

How to exit pdb and allow program to continue? Question: I’m using the pdb module to debug a program. I’d like to understand how I can exit pdb and allow the program to continue onward to completion. The program is computationally expensive to run, so I don’t want to exit without the script attempting to …

Total answers: 9

pdb doesn't respond after pdb.set_trace() call

pdb doesn't respond after pdb.set_trace() call Question: I have parent process calling its child. I’ve put import pdb; pdb.set_trace() into the child process code. When I launch the parent with python -m pdb parent.py it’s getting frozen. The debugger doesn’t respond to any command I type. But when I hit quit or continue it does …

Total answers: 2