timlee126 at yahoo.com
Fri Jul 24 12:52:01 EDT 2009
Thanks! If that is the case, i.e. the parent doesn't wait, is the code in my last post wrong? "result" could be nothing.
--- On Fri, 7/24/09, Diez B. Roggisch <deets at nospam.web.de> wrote:
> From: Diez B. Roggisch <deets at nospam.web.de>
> Subject: Re: Popen
> To: python-list at python.org
> Date: Friday, July 24, 2009, 12:35 PM
> Tim schrieb:
> > Thanks! Yes I mean subprocess.Popen.
> > I was wondering the meaning of "asynchronously"
> > Here is some code I am reading recently:
> > "
> > result = Popen(cmdline,shell=True,stdout=PIPE).stdout
> for line in result.readlines():
> > if find(line,"Cross") != -1:
> > return
> float(split(line)[-1][0:-1]) "
> > The computation in the program "cmdline" takes a long
> time, at the end of which the results will be output to
> > "asynchronous" seems to mean Popen returns to the
> parent process immediately and the parent and child
> processes continue to be executed.
> > However, if Popen returns immediately to the parent
> process, then there will be nothing in "result", not to
> mention extracting information from the output. Thus it
> seems to me the parent process has to wait till the child
> process finish.
> > So how to understand the meaning of "asynchronous"?
> "Asynchronous" means asynchronous - the parent is *not*
> Which is the reason that there is (amongst other things)
> the "wait"-method you can call to wait for the child to be
> -- http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list