Last active
March 24, 2021 02:56
-
-
Save chausen/56bc7b8cacaa34165c6ed387ce46b910 to your computer and use it in GitHub Desktop.
Using pdb to debug a python file when using input redirection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
s = input() | |
# pdb uses stdin to be interactive; this switches stdin to be the teletype interface | |
# (terminal and keyboard) after getting the redirected input | |
sys.stdin = open("/dev/tty") | |
breakpoint() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment