> I would like to use pdb in an application where it isn't possible to use > sys.stdin for input. I've read in the documentation for pdb.Pdb that a file > object can be used instead of sys.stdin. Unfortunately, I'm not clear about > my options for the file object. > > I've looked at rpdb on PyPI, which re-routes stdin and stdout to a socket > handler. I can connect to the socket with telnet. This works well.
You can use the code from https://docs.python.org/3/library/fileinput.html#module-fileinput to change this code: for line in sys.stdin.readlines(): process(line) to this: import fileinput for line in fileinput.input(): process(line) Then, write the data you would expect to come on STDIN to a file and run your program: $ python my-program.py myfile It will work as normal when you run it normally: $ data-generation-command | python my-program.py -- https://mail.python.org/mailman/listinfo/python-list