Capturing stdout from a console process?

Daniel Klein DanielK at aracnet.com
Sat Dec 16 12:55:20 EST 2000


Have a look at the popen2 module which provides classes for managing the
stdin, stdout and stderr of sub-processes. Mr. Lundh's excellent ebook "The
Standard Python Library" has good examples of its use.

Daniel Klein

"Sam Schulenburg" <samschul at pacbell.net> wrote in message
news:91b8q3$aqu$1 at nnrp1.deja.com...
> I am using <os.system("xcopy c:*.* d: /v")> within a python program to
> copy files from one directory to another under windows NT. When the
> program executes, a new console window is created with the results of
> the xcopy command being displayed in the console window. Is their a way
> to capture this output by python so I can log error messages?
>
> Sam Schulenburg
>
>
> Sent via Deja.com
> http://www.deja.com/





More information about the Python-list mailing list