This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skip.montanaro
Recipients skip.montanaro
Date 2008-01-24.20:21:14
SpamBayes Score 0.0041348543
Marked as misclassified No
Message-id <>
From a thread on python-dev...

Mike Kent mike.kent at
Thu Jan 24 16:33:47 CET 2008

Recently I was trying to debug an old python program who's maintenance I
inherited.  I was using the quick-and-dirty method of putting some 'print
>>sys.stderr' statements in the code, and then running the command with
'2>filename' appended to the end of the command line.  Imagine my surprise
to see that all of the prompt text from the program's raw_input calls were
also disappearing from the screen output, and appearing in the stderr
output routed to the file.

The latest documentation for raw_input states "If the prompt argument is
present, it is written to standard output without a trailing newline."
I posted a question regarding the observed behavior to comp.lang.python
and Gabriel Genellina (thanks Gabriel!) pointed out that despite the
documentation, raw_input was hard-coded to always output its prompt text
to stderr.

This raises two questions:
1. Shouldn't the current documentation be corrected to state that raw_input
writes its prompt to standard error?
2. Is this really the hard-coded behavior we want?  I don't think my
use-case is that odd; in fact, what I find very odd is that the prompt
output is send to stderr.  I mean, I'm printing the prompt for a question,
not some error message. Can there not at least be an optional parameter to
indicate that you want the output sent to stdout rather than stderr?

... after a few responses ...

Guido van Rossum guido at
Thu Jan 24 21:09:12 CET 2008

On Jan 24, 2008 11:41 AM, Mike Kent <mike.kent at> wrote:
> Interesting point about whether GNU readline is installed.  My setup
is RedHat
> Linux, with Python 2.5 that I built and installed myself.  GNU
readline is not,
> in fact, installed.  If you look at Python2.5/Parser/myreadline.c,
> PyOS_StdioReadline, line 125, you will see that prompt output is being
sent to
> stderr.  As best as my Python-fu can determine, this is the code used
to output
> a raw_input prompt (thanks again to Gabriel Genellina for pointing me
in the
> right direction.)
> It's entirely likely that the difference in what I am seeing and what
you guys
> are seeing is caused by my not having GNU readline installed. 
> the behavior without it seems wrong, and is certainly different from the
> documentation.

Date User Action Args
2008-01-24 20:21:19skip.montanarosetspambayes_score: 0.00413485 -> 0.0041348543
recipients: + skip.montanaro
2008-01-24 20:21:18skip.montanarosetspambayes_score: 0.00413485 -> 0.00413485
messageid: <>
2008-01-24 20:21:17skip.montanarolinkissue1927 messages
2008-01-24 20:21:15skip.montanarocreate