from subprocess import Popen, PIPENote, I'm not bothering to check the exit status. You can see my previous post about how to do that.
p1 = Popen(["sort"], stdin=PIPE, stdout=PIPE)
p2 = Popen(["uniq", "-c"], stdin=p1.stdout, stdout=PIPE)
for line in p2.stdout:
Now, here's the question. Why does the program freeze if I put the two Popen lines together? I don't understand why I can't setup the pipeline, then feed it data, then close the stdin, and then read the result.