raw_input(), STRANGE behaviour

Dox33 Rens.Duijsens at gmail.com
Sun Jan 27 01:40:50 CET 2008


Hello Mike,

Thanks for your reply.
Since I momentarily do not have the ability to build a new python
executable, I would like to ask for your help in this case.
Are you able to supply me with a corrected version?

Friendly greetings

Rens Duijsens

On 26 jan, 16:50, Mike Kent <mrmak... at cox.net> wrote:
> On Jan 26, 7:23 am, Dox33 <Rens.Duijs... at gmail.com> wrote:
>
>
>
>
>
> > I ran into a very strange behaviour of raw_input().
> > I hope somebody can tell me how to fix this.
> ===CUT===
> > *** Thirst, redirect stderr to file, STRANGE behaviour......
> > From the command prompt I run:
> > python script.py 2> stderr_catch.txt
> > This should redirect strerr to the file and stdout should stay on the
> > screen.
>
> > But..... What happens?
> > After a few 'enter' keys, on screen apears:
> > 1: This is the print statement.
> > 3: This is a possible solution.
>
> > WHERE IS THE SECOND LINE?
> > It is in the file stderr_catch.txt!!!
>
> > **** See the problem?
> > Please Tell me? Why is the prompt produced by raw_input() printed to
> > the error channel? It should be stdout, just as the print statement
> > does.
>
> I recently ran into this behaviour myself, and reported it both here
> and to the python-dev mailing list.  Seehttp://groups.google.com/group/comp.lang.python/browse_thread/thread/...
>
> It turns out that *if* you don't have GNU readline installed, Python
> falls back to its own implementation of readline, which is hard-coded
> to send the prompt output to stderr.  Guido agreed that this is wrong,
> and a bug for it has been entered into the Python bug tracking
> database.
>
> Your workaround until this bug is fixed is to install GNU readline,
> and rebuild your python installation to use it rather than the fall-
> back version.- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -




More information about the Python-list mailing list