<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: &quot;Alan Gauld&quot; &lt;
<a href="mailto:alan.gauld@btinternet.com">alan.gauld@btinternet.com</a>&gt;<br>Subject: Re: [Tutor] handling timeouts, normal completion,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exceptions when interacting with CVS<br>To: <a href="mailto:tutor@python.org">
tutor@python.org</a><br>Message-ID: &lt;<a href="mailto:ejrdq7$a5h$1@sea.gmane.org">ejrdq7$a5h$1@sea.gmane.org</a>&gt;<br>Content-Type: text/plain; format=flowed; charset=&quot;iso-8859-1&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reply-type=original
<br><br><br>&quot;Tony Cappellini&quot; &lt;<a href="mailto:cappy2112@gmail.com">cappy2112@gmail.com</a>&gt; wrote<br><br>&gt; def SendCVSCommand(self)<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.__cvsCmd = &quot;cvs update -A -C someArchiveName&quot;
<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hProcess = popen(self.__cvsCmd, &quot;r&quot;) # will run the cvs<br>&gt; command,<br>&gt; and checkout this module to the current directory<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # HOW LONG DO WE WAIT BEFORE CONTINUING????
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(timeToWait)<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # how do we check for errors??????????<br><br>&gt;&gt;I don't think you need the sleep because the call to popen won't<br>&gt;&gt;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>&gt;&gt;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;">&gt;&gt;and stderr just as you would at a console.
</blockquote><div><br><br>I tried this<br>for line in hProcess.readlines():<br>&nbsp;&nbsp;&nbsp; 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;">&gt;&gt;You probably want to use popen2 or popen3 to separate the<br>&gt;&gt;stdout/stderr streams.
<br><br></blockquote></div><br>