Skip to content Skip to sidebar Skip to footer

Why Is Pdb On Python 3 Ignoring My Ctrl+c And Just Displaying "--keyboardinterrupt--"

Under pdb in Python 2 I could CTRL-C and quit my Python program. Under Python 3.6 I doesn't do that, just displays --KeyboardInterrupt-- and ignores me. In order to quit, I need t

Solution 1:

I still consistently have the same behavior. Maybe it’s a glitch in my environment but otherwise I can’t see the benefit of explicitly ignoring a user’s request to terminate a program with CTRL+C.

However, I have found that hitting ‘q’ triggers pdb quit which mostly ends up with the desired result, termination of the program. And, unlike CTRL+D has no risk of closing the launching bash session either.

edit - this did the trick 😀

(I have code that is made to trap exceptions, which is why a simple q/quit was hit or miss)

as per Is there a way to prevent a SystemExit exception raised from sys.exit() from being caught?

🧨 : note its warning about no cleanup code being run

# ~/.pdbrcalias qq import os; os._exit(1)

Post a Comment for "Why Is Pdb On Python 3 Ignoring My Ctrl+c And Just Displaying "--keyboardinterrupt--""