[Tutor] handling timeouts, normal completion, or

Tony Cappellini cappy2112 at gmail.com
Mon Nov 20 18:26:51 CET 2006


> Message: 1
> Date: Mon, 20 Nov 2006 05:17:59 -0000
> From: "Alan Gauld" <alan.gauld at btinternet.com>
> Subject: Re: [Tutor] handling timeouts, normal completion,      or
>         exceptions when interacting with CVS
> To: tutor at python.org
> Message-ID: <ejrdq7$a5h$1 at sea.gmane.org>
> Content-Type: text/plain; format=flowed; charset="iso-8859-1";
>         reply-type=original
>
>
> "Tony Cappellini" <cappy2112 at gmail.com> wrote
>
> > def SendCVSCommand(self)
> >
> >      self.__cvsCmd = "cvs update -A -C someArchiveName"
> >
> >      try:
> >         hProcess = popen(self.__cvsCmd, "r") # will run the cvs
> > command,
> > and checkout this module to the current directory
> >         # HOW LONG DO WE WAIT BEFORE CONTINUING????
> >         sleep(timeToWait)
> >
> >         # how do we check for errors??????????
>
> >>I don't think you need the sleep because the call to popen won't
> >>return untl the command has completed.


The last line was truncated- this is why the sleep call must be there
hProcess.close()
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

>>And you check for errors by reading the output from stdout

> >>and stderr just as you would at a console.



I tried this
for line in hProcess.readlines():
    print line

I called this every several seconds, before the sleep(3) call

Nothing is returned from cvs- not one single ascii character.

>>You probably want to use popen2 or popen3 to separate the
> >>stdout/stderr streams.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061120/608c2ee9/attachment.html 


More information about the Tutor mailing list