Sorry to reply to myself again, but I think I now know the answer and
wish to post it for the archives.
Python run without '-i', if not sys.stdin.isatty(), expects to read a
whole script before doing anything else (presuming to be reading it
from a pipe). Therefore syntax errors are fatal, but oth
Further to my query about trying to make Python run unbuffered, I have
discovered that a SyntaxError seems to cause Python to close its SSH
connection:
$ ssh localhost python -u
,
File "", line 1
,
^
SyntaxError: invalid syntax
$
Whereas a different sort of error (e.g. NameError) does n
Hi,
The man page for python says:
"-u Force stdin, stdout and stderr to be totally unbuffered."
However, when I try:
$ ssh localhost python -u
print 'hello, world'
[^D]
hello, world
$
Nothing happens until I send that EOF. I'm pretty sure it's not SSH
that's buffering because when I try:
locally under windows using Xitami as localhost. If I
run in unbuffered mode (shebang line ``#!/usr/bin/python -u``) it works
fine. Without unbuffered mode (shebang line ``#!/usr/bin/python``) it
truncates the file.
This happens even if I add ``sys.stdout.flush()`` into the loop.
Does anyone know