Is there any way to pass 'stdin' as an argument to another process in python?
I'm trying to create a script which is using multiprocessing module with python. The script (lets call it myscript.py) will get the input from another script with pipe. Assume that I call the scripts like this; $ python writer.py | python myscript.py And here is the codes; // writer.py import time, sys def main(): while True: print "test" sys.stdout.flush() time.sleep(1) main() //myscript.py def get_input(): while True: text = sys.stdin.readline() print "hello " + text time.sleep(3) if __name__ == '__main__': p1 = Process(target=get_input, args=()) p1.start() this is clearly not working, since