raw_input weirdness -- shell's fault?
Matthew Dixon Cowles
matt at mondoinfo.com
Tue Sep 5 21:11:09 EDT 2000
On Wed, 06 Sep 2000 00:45:07 GMT, Jonadab the Unsightly One
<jonadab at bright.net> wrote:
>I'm getting some weirdness when calling a python script that
>does raw_input. It works okay from COMMAND.COM, but when I
>call it from eshell I get this...
[...]
>That is, the prompts weren't printed until the script
>exited.
It seems that Python isn't flushing its output buffer, presumably
because it doesn't know that it's running interactively. I don't know
enough about NT to know why that might be but running Python as
python -u
forces stdin, stdout, and stderr to be unbuffered and should help. So
should putting a
sys.stdout.flush()
after your print statements.
Regards,
Matt
More information about the Python-list
mailing list