On Sun, Aug 31, 2008 at 11:39 PM, 王珂 <[EMAIL PROTECTED]> wrote: > --Then I use: > print "Download begin ..." > p = subprocess.Popen(["robocopy.exe" +" " + "DownloadArgs"],Shell = > True,stdout = PIPE) > while not str(p.poll()).isdigit(): > print ">", > time.sleep(10) > #don't know how to grab output and display portion of it > print "Download complete with retval (%d) "% (p.poll()) > > This will make robocopy never terminate, and display ">>>>>>" forever.
I am not an expert in Popen, but I think in this example robocopy is blocked trying to output. Here is how to read the robocopy output: p = subprocess.Popen(["robocopy.exe" +" " + "DownloadArgs"],Shell = True,stdout = PIPE) while True: line = p.stdout.readline() if not line: break print line Kent _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
