-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Add guide to install ipdb
to sys.excepthook
#272
Comments
@hacker-DOM I've had success with the following: import sys
import ipdb
sys.breakpointhook = ipdb.set_trace
sys.excepthook = lambda *args: ipdb.pm() |
Hmm, yeah it seems to work. The only weird thing is they don't work together :D import sys
import ipdb
sys.breakpointhook = ipdb.set_trace
sys.excepthook = lambda *args: ipdb.pm()
def main():
breakpoint()
print("Hello World!")
print("Hello World!")
print("Hello World!")
assert False
print("Hello World!")
main() breakpoint launches ipdb, I enter I'm on python==3.8.12 and ipdb==0.13.13; can you reproduce this behavior @Jasha10 ? |
Yes, I can reproduce the behavior. # tmp.py
import sys
import ipdb
sys.breakpointhook = ipdb.set_trace
sys.excepthook = lambda *args: ipdb.pm()
print("BEFORE BREAKPOINT")
print(f"{sys.excepthook=}")
print(f"{sys.excepthook.__module__=}")
breakpoint()
print("AFTER BREAKPOINT")
print(f"{sys.excepthook=}")
print(f"{sys.excepthook.__module__=}")
This happens because the |
Interesting. @gotcha do you think there would be a way to enable ipdb globally w/o this gotcha? Thanks in advance |
Hi guys!
It seems like this is possible with
with launch_ipdb_on_exception
, but it would be great if there was a way to do it globally, for debugging a third-party library. Thanks in advance 👍Ps: This issue is analogous to cansarigol/pdbr#66.
The text was updated successfully, but these errors were encountered: