views:

43

answers:

1

I've been using Cygwin on Windows recently. I want to use the Windows installation of Python, so during testing I'm using /cygdrive/c/Python26/python.exe myfile.py rather than python myfile.exe.

This is working almost perfectly, except for printing. When I run the Windows Python from Cygwin the output doesn't print until execution finishes. It works fine running in Windows Python from explorer.exe or cmd.exe, and it works in Cygwin using the Cygwin-installed Python (/bin/python.exe).

Is there a workaround for this? The important thing is to be able to run the Windows version, but I'd like to do it all from with Bash.

+3  A: 

Perhaps if you flush the output

import sys

V = range(100000)
for x in V:
    print x
    sys.stdout.flush()
Amro
Well, whaddya know - it worked, thanks!
Skilldrick