Launching a subprocess without waiting around for the result?
bignose+hates-spam at benfinney.id.au
Fri Sep 19 00:33:04 CEST 2008
erikcw <erikwickstrom at gmail.com> writes:
> I have a cgi script where users are uploading large files for
> processing. I want to launch a subprocess to process the file so the
> user doesn't have to wait for the page to load.
For "how do I deal with subprocesses from Python", the (new in Python
2.4) 'subprocess' module is the default go-to answer
<URL:http://www.python.org/doc/lib/module-subprocess>, replacing a
rather fragmented set of modules before it.
> What is the correct way to launch subprocess without waiting for the
> result to return?
Creating an instance of 'subprocess.Popen' will launch the process and
return the Popen instance. You then have the option of polling it or
waiting for it to complete.
\ “To stay young requires unceasing cultivation of the ability to |
`\ unlearn old falsehoods.” —Robert Anson Heinlein |
More information about the Python-list