<br><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Message: 1<br>Date: Mon, 20 Nov 2006 05:17:59 -0000<br>From: "Alan Gauld" <
<a href="mailto:alan.gauld@btinternet.com">alan.gauld@btinternet.com</a>><br>Subject: Re: [Tutor] handling timeouts, normal completion, or<br> exceptions when interacting with CVS<br>To: <a href="mailto:tutor@python.org">
tutor@python.org</a><br>Message-ID: <<a href="mailto:ejrdq7$a5h$1@sea.gmane.org">ejrdq7$a5h$1@sea.gmane.org</a>><br>Content-Type: text/plain; format=flowed; charset="iso-8859-1";<br> reply-type=original
<br><br><br>"Tony Cappellini" <<a href="mailto:cappy2112@gmail.com">cappy2112@gmail.com</a>> wrote<br><br>> def SendCVSCommand(self)<br>><br>> self.__cvsCmd = "cvs update -A -C someArchiveName"
<br>><br>> try:<br>> hProcess = popen(self.__cvsCmd, "r") # will run the cvs<br>> command,<br>> and checkout this module to the current directory<br>> # HOW LONG DO WE WAIT BEFORE CONTINUING????
<br>> sleep(timeToWait)<br>><br>> # how do we check for errors??????????<br><br>>>I don't think you need the sleep because the call to popen won't<br>>>return untl the command has completed.
</blockquote><div><br>The last line was truncated- this is why the sleep call must be there <br>hProcess.close()<br>This cannot be called until the cvs transaction has finished, but since I don't know how long to wait, I arbitrary used 30 seconds in the argument to sleep
<br><br></div>>>And you check for errors by reading the output from stdout<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">>>and stderr just as you would at a console.
</blockquote><div><br><br>I tried this<br>for line in hProcess.readlines():<br> print line<br><br>I called this every several seconds, before the sleep(3) call<br></div><br>Nothing is returned from cvs- not one single ascii character.
<br>
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">>>You probably want to use popen2 or popen3 to separate the<br>>>stdout/stderr streams.
<br><br></blockquote></div><br>