erikcw wrote: > On Sep 18, 3:33 pm, Ben Finney <[EMAIL PROTECTED]> > wrote: >> erikcw <[EMAIL PROTECTED]> 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 | >> _o__) | >> Ben Finney > > So if I create a Popen object and then just ignore the object and exit > the program the subproccess will finish it's work and then exit itself > cleanly? Just so happens that I ran into the same problem recently. I started with exec(), then os.system(), next os.popen(), and last os.spawn(). This is what I discovered on a windows platform. The exec() replaced the current running process. os.system did not start a completely new process. os.popen() created a new process but did not open a command box to display any print statements. Lastly os.spawn() worked - it created a new process and opened a command box to display any print statements I needed.
Johnf -- http://mail.python.org/mailman/listinfo/python-list