I have an issue with writing the output of a program when it also prompts for user input.
In write_output.py:
content = [str(i+1)+' blabla'*50 for i in range(200)]
for line in content:
    print line
a = raw_input('Write something:\n')
print 'You wrote:',a
In show_output.py:
from subprocess import Popen,PIPE
popen = Popen(['python','write_output.py'],stdout=PIPE,stderr=PIPE)
for line in iter(popen.stdout.readline,''):
    print line
popen.wait()
The output of show_output.py stops at line 197, but you can still give the input value and it will print out the rest
If I just use 'blabla' instead of 'blabla'*50, show_output.py prints nothing, and again the input can still be given and everything will be printed out. 
If I comment out the last two lines in write_output.py, then show_output.py writes everything as expected in both cases.
Can someone explain what is going on?
Why does asking for input changes the stdout of subprocess?
