I m very new to programming so I apologize in advance if my question is too silly.
#!/usr/bin/python2.6
import subprocess, time
p=subprocess.Popen([ cat ], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
for i in abcd :
p.stdin.write(str.encode(i+
))
output=p.stdout.readline()
print(output)
time.sleep(1)
Executing this code in Python 2.6 prints letters a, b, c, d , each line of output appears after a second. This is expected behavior.
But in Python 3.1 execution is blocked at line output=p.stdout.readline()
.
How to correct this for Python 3.1?