I am trying to write a program that simultaneously reads and writes to the std (out / in) process, respectively. However, it seems that writing to the stdin program in the stream does not work. Here are the relevant code bits:
import subprocess, threading, queue def intoP(proc, que): while True: if proc.returncode is not None: break text = que.get().encode() + b"\n" print(repr(text))
What is going wrong and is there a way to fix it?
I am running python 3.1.2 on Mac OSX, it confirmed that it works in python2.7.
source share