Re: Unbuffered mode

2008-02-13 Thread Hamish Allan
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

Re: Unbuffered mode

2008-02-13 Thread Hamish Allan
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

Unbuffered mode

2008-02-12 Thread Hamish Allan
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:

Truncated file without unbuffered mode

2005-03-15 Thread Fuzzyman
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