Subprocess with a Python Session?

Fredrik Lundh fredrik at pythonware.com
Thu Dec 7 10:56:16 EST 2006


Giovanni Bajo wrote:

>>> assert p.stdout.readline() == '10\n'
> 
> Yeah, but WHY was the API designed like this? Why can't I read and write 
> freely from a pipe connected to a process as many times as I want?

the subprocess module is designed to deal with Unix-style subprocesses 
in general, not interactive tty-based applications.

you can fake it with some applications, if you make sure to flush your 
buffers and make sure you don't deadlock, but the right way to run an 
interactive tty-based application on remote is to attach it to a pseudo-
tty.

</F>




More information about the Python-list mailing list