On Tue, Mar 19, 2019 at 2:50 AM <finnkochin...@keemail.me> wrote:
>
> Hello,
> I try to start a separate python subprocess using the attached code. This 
> example should catch all stdout and stderr output from the launched 
> subprocess and send commands to its stdin.
> The problem is that the prompt ">>>" asking for then next input is neither 
> sent to stdout nor to stderr. The commands sent to stdin aren't echoed to 
> stdout either.
>

Many programs behave differently when they're connected to an actual
TTY compared to being connected to a pipe. What you often need to do
is use a pseudo-terminal, which you can then feed stuff to and capture
stuff from. Python makes this available with the pty module:

https://docs.python.org/3/library/pty.html
https://docs.python.org/2/library/pty.html

(I would strongly recommend using Python 3 rather than Python 2, but
it should be possible to do either way.)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to