Can someone explain this unexpected raw_input behavior?

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Jan 23 22:23:01 EST 2008


Mike Kent <mrmakent at cox.net> writes:

> Consider an interactive program, that asks the user several
> questions, and displays paragraphs of information based on those
> questions. The paragraphs are output using print, and the questions
> are asked via raw_input.

Okay so far.

> You want to do some simple debugging of the program by printing some
> debugging statements via 'print >>sys.stderr', and you don't want
> the debug output mixed in with the normal output on the screen, so
> you try to route the debugging output to a file by adding
> '2>filename' to the end of the command line.

This issue isn't specific to Python. "Program stops to ask questions
from the user" is not compatible with "Can safely redirect output of
the program to a file".

Either one, or both, of those requirements will have to be
compromised, or dropped completely.

-- 
 \                           "Holy hole in a donut, Batman!"  -- Robin |
  `\                                                                   |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list