raw_input - why doesn't prompt go to stderr
Helmut Jarausch
jarausch at skynet.be
Tue Jan 27 12:53:09 EST 2004
Terry Reedy wrote:
> "Helmut Jarausch" <jarausch-remove at igpm.rwth-aachen.de> wrote in message
> news:bv2smu$leh$1 at nets3.rz.RWTH-Aachen.DE...
>
>
>>when using an interactive Python script, I'd like the prompt given by
>>raw_input to go to stderr since stdout is redirected to a file.
>
>
> This is not the usual behavior, so I presume that you or the code author
> (if not the same) have done some non-standard redirection.
Ofcourse I did the redirection of stdout.
And here is an example which I give in my C++ courses when I tell the
students to use 'cerr' for outputting a prompt (in Python)
FileName= raw_input('please enter the name of data file')
input= open(FileName,'r')
...
print tons of output
And this is very handy.
While testing I don't redirect stdout and so can see the output
immediately. Then I just redirect stdout for a 'production' run.
Tell me any advantage in raw_input's prompt is going to stdout instead
of stderr?
Thanks for your comments,
Helmut.
--
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
More information about the Python-list
mailing list