Search Results

Search found 1 results on 1 pages for 'beary605'.

Page 1/1 | 1 

  • Python: Streaming Input with Subprocesses

    - by beary605
    Since input and raw_input() stop the program from running anymore, I want to use a subprocess to run this program... while True: print raw_input() and get its output. This is what I have as my reading program: import subprocess process = subprocess.Popen('python subinput.py', stdout=subprocess.PIPE, stderr=subprocess.PIPE) while True: output=process.stdout.read(12) if output=='' and process.poll()!=None: break if output!='': sys.stdout.write(output) sys.stdout.flush() When I run this, the subprocess exits almost as fast as it started. How can I fix this?

    Read the article

1