I'm trying to retrieve the output of a terminal command sent by python. I have used subprocess.Popen(command, stdout=subprocess.PIPE ).communicate()[0] in the past which gives me the output but only after the process is finished. I need to find a way to get the output as the command runs. I have also tried subprocess.Popen(command, stdout=subprocess.PIPE ).stdout.readline() but it stops working after approx. 50 lines. I think that this command uses a stdout buffer which is being filled.

Thanks in advance for your suggestions.