That is too easy. I was looking at the examples of how to replace the old popen and I just did not get it but the page you sent is great.
John -----Original Message----- From: Danny Yoo [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 19, 2005 10:34 To: Ertl, John Cc: tutor@python.org Subject: Re: [Tutor] Popen and sending output to a file On Wed, 19 Jan 2005, Ertl, John wrote: > I am using the subprocess.Popen from 2.4. I can launch a job from > python and the output from the job goes to the screen but now I would > like to have the output go to a file. I could do the crude > > subprocess.Popen("dtg | cat > job.out", shell=True) > > But I would think there is a better way built into Popen but I could not > figure out the documentation. Hi John, According to: http://www.python.org/doc/lib/node227.html we can redirect standard input, output, and error by calling Popen with the 'stdin', 'stdout', or 'stderr' keyword arguments. We should be able to do something like: ### job_output = open("job.out", "w") subprocess.Popen("dtg", shell=True, stdout=job_output) ### Best of wishes to you! _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor