Closed bwoodsend closed 11 months ago
The behavior that you're seeing is sticky
mode, which is the default mode. Type sticky
from a Pdb+ prompt and press Enter to switch to non-sticky mode, which gets you what you want.
You can also update CLEARSCREEN behavior directly from a breakpoint:
(Pdb+) from seleniumbase import pdbp
(Pdb+) pdbp.CLEARSCREEN = ""
With sticky mode off, I loose the nice function context. Why do seeing the function and seeing the exception have to be mutually exclusive? Why not have both?
You can still scroll up to see the exception message if there is one. And sometimes, there's a long exception message, in which case you wouldn't want it to cover over the location in the current stack (or at least most people wouldn't want that.)
And if you don't like the default settings, you can easily modify them by updating an __init__.py
file with those settings. Eg:
from seleniumbase import pdbp
pdbp.CLEARSCREEN = ""
import pdb
if hasattr(pdb, "DefaultConfig"):
pdb.DefaultConfig.filename_color = pdb.Color.fuchsia
pdb.DefaultConfig.line_number_color = pdb.Color.turquoise
pdb.DefaultConfig.truncate_long_lines = False
pdb.DefaultConfig.sticky_by_default = True
FWIW I do find this behavior quite confusing. While it's easy to handle once you know about it, it makes it harder to encourage colleagues to move from pdb/pdppp to pdbp given the modal first experience is "where's did the exception go??".
To the extent sticky mode could still show the exception, that would be much nicer!
Whenever an exception is raised, the usual exception+stack trace is printed but then pdbp runs its clear screen leaving you with nothing but what comes after – an arrow pointing to the offending line of code without even the exception type to say what's wrong with it.
For example:
If I
c
through to the exception I just get the following which is pretty but less useful to me than boring oldpdb
.It would be a lot more practical for the sequence to be, clear screen -> dump exception/stacktrace -> print current code location.
That all said, I'm personally happier to let the terminal do the scrolling. If I disable the clear screen (edit
pdbp.py
and setCLEARSCREEN
to an empty string), the resultant UX is perfect for me.