I have read tons of posts but still can't seem to figure it out.
I want to subprocess.Popen() rsync.exe in windows, and print the stdout in python.
My code works, but it doesn't catch the progress until a file is done transfered! I want to print the progress for each file in realtime.
Using python 3.1 now since I heard it should be better at handling IO.
import subprocess, time, os, sys cmd = "rsync.exe -vaz -P source/ dest/" p, line = True, 'start' p = subprocess.Popen(cmd, shell=True, bufsize=64, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE) for line in p.stdout: print(">>> " + str(line.rstrip())) p.stdout.flush()