Capturing stdout from a console process?

Ben Hutchings ben.hutchings at roundpoint.com
Fri Dec 15 12:52:05 EST 2000


Sam Schulenburg <samschul at pacbell.net> writes:

> 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?

Yes, but you might find it easier to use something based on the source
for shutil.copytree (which is commented as being `an example rather
than a tool').

-- 
Any opinions expressed are my own and not necessarily those of Roundpoint.



More information about the Python-list mailing list