spawn and standard output

Jörg Wölke dvass at felis.uni-freiburg.de
Thu Feb 14 06:05:45 EST 2002


DelPiccolo Ivano schrieb:
 
> You can also redirect your command to a specific file and read it.
> example :
> os.system("ls -la>foo.txt")
> after you open the file foo.txt and you read it.
> 
> The problem of using that method, stdout and stdin are in the same file.
                                   
s/stdin/stderr

> When you read your file you have to do treatment to detect if the
> information is coming from stdout or stderr.

So why not:

os.system("ls -la > foo.txt 2>foo.error.txt")

This won't work with a cshell.

HTH,HAND
and Greetings J"o!

-- 
$ make LOVE
Make: Don't know how to make LOVE.  Stop.
$



More information about the Python-list mailing list