My python script uses subprocess to call an another script, which produces output very slow(line-by-line basis). I would like to write the output line by line to file not when the whole process ends and writes the entire output as string.The following code writes the output to "file" when the "script" ends.
args = ("script")
file = open('output.txt', 'w')
subprocess.Popen(args,stdout=file)
Is it even possible ? Thanx, Chris