inducer / pudb

Full-screen console debugger for Python
https://documen.tician.de/pudb/
Other
3k stars 230 forks source link

Piping input to script to be debugged leads to TypeError #423

Closed pyrrhull closed 3 years ago

pyrrhull commented 3 years ago

I am wondering if this is possible with pudb or if there is a workaround. I try to debug a script that gets its input from stdin over a pipe like this:

cat input.txt | python script.py

I already tried to set PYTHONBREAKPOINT=pudb.forked.set_trace but i always get the error:

TypeError: ord() expected a character, but string of length 0 found.

inducer commented 3 years ago

No, pudb expects stdin to be a pty.

pyrrhull commented 3 years ago

Meanwhile I found this to work:

read = sys.stdin.readlines() 
sys.stdin = open("/dev/tty")
breakpoint()