Why does pdb display "*** Blank or comment" when I try to install Break?

I am working with my Django app. For some reason, the list item is not assigned correctly.

I am trying to establish a gap where, I think, an error occurs. (line 20)

I call pdb with this line of code:

import pdb; pdb.set_trace() 

However, inside the code I cannot install Break.

 (Pdb) b 20 *** Blank or comment (Pdb) break 20 *** Blank or comment ` 

What am I doing wrong?

+4
source share
1 answer

pdb tells you that line 20 of the file you are in does not contain code; it is either empty or just contains a comment. Such a line will never be executed, so you cannot set a breakpoint on it.

Use the "list" command to see the code of the file you are currently on (the "reference list" for more information about this command), and then set breakpoints on lines that include executable code.

You can also use the where command to see the stack frame, since you cannot be in the desired file because you are not looking at the level of the stack frame where you think. Use "up" and "down" to go to the stack level where you want to debug.

+4
source

All Articles