sys.stdout linebuffered

Peter Hansen peter at engcorp.com
Wed May 26 12:48:30 EDT 2004


Thomas Guettler wrote:

> I like to use #!/usr/bin/env
> 
> ===> cat minus-u.py
> #!/usr/bin/env python -u
> 
> ===> ./minus-u.py
> /usr/bin/env: python -u: No such file or directory

Consider using /usr/bin/python instead?

>>Nevertheless, in the unlikely case that you
>>absolutely cannot use the -u switch, look at the description of
>>that option in the output of "python -h" and use the environment
>>variable mentioned there instead.
> 
> The environment variable has the drawback,
> that I need to set it before every call to this
> script. Other scripts should not be unbuffered.

If this is the only script with special needs, why not
just create a separate shell script which invokes python
on the other script directly?

#!/bin/sh
/usr/bin/env python -u specialscript.py


-Peter



More information about the Python-list mailing list