How do I list the current line in python PDB?
Late but hopefully still helpful. Make the following alias:
alias ll u;;d;;l
Then whenever you type ll
, pdb will list from the current position. It works by going up the stack and then down the stack, which resets 'l' to show from the current position. (This won't work if you are at the top of the stack trace.)
Tip: Permanent alias
To make the alias permanent, add the line into your .pdbrc
-file in the user home directory (~/.pdbrc
). This works with both pdb and ipdb.
In Python 3.2 and higher, you can use list .
to reset the list location.