Getting stdout and stderr from popen

Donn Cave donn at drizzle.com
Thu Mar 7 01:46:30 EST 2002


Quoth Stefan Heimann <stefan.heimann at web.de>:
| Donn Cave <donn at u.washington.edu> wrote::
...
| I am on unix but I want it to work on windows, too.
|
|> ...  For example, suppose you record the output of "make", which
|> will be both output and error streams.  If you read them separately,
|> you won't be able to tell which compiler errors belong to which
|> make commands.
|
| That's what I need! Is it really so complicated? I think it should be
| common that someone needs to read stdout and stderr ordered by time.

I don't know.  You probably know more about Windows than I do.  But
yes, I wouldn't be surprised if it's impossible to get stdout and
stderr in the same pipe.

But maybe our UNIX background leads us to make this a more significant
problem than it is.  If you haven't already checked this, run "cvs status"
and whatever else you're interested in, and make sure you really have a
problem.  Once upon a time, I proposed that, now that you can write
"print >> sys.stderr", most of the print commands in the Python library
should probably be changed to do that, since they're mostly diagnostic
in nature.  That sounds obvious, but to my surprise a couple of people
here who use Windows a lot but are otherwise pretty computer literate
were very negative about it - apparently, stderr is generally awkward
and unpleasant on Windows.  At the same time, some of the UNIX facilities
for dealing with separate I/O streams are obviously missing.  So perhaps
on Windows one just doesn't write to stderr all that often, as there's
no point in the distinction.

	Donn Cave, donn at drizzle.com



More information about the Python-list mailing list