I wrote: > And here's a thread example, based on Benjamin's code: [...] Doh! Race condition. Make that:
import subprocess import thread import Queue def readtoq(pipe, q): q.put(pipe.read()) cat = subprocess.Popen('cat', shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE) myVar = str(range(1000000)) # arbitrary test data. q = Queue.Queue() thread.start_new_thread(readtoq, (cat.stdout, q)) cat.stdin.write(myVar) cat.stdin.close() cat.wait() myNewVar = q.get() assert myNewVar == myVar print len(myNewVar), "bytes piped around." -- --Bryan -- http://mail.python.org/mailman/listinfo/python-list