[Supervisor-users] flush output
Chris McDonough
chrism at plope.com
Thu Oct 2 11:33:45 EDT 2008
Antonio Beamud Montero wrote:
> El jue, 02-10-2008 a las 10:56 -0400, Chris McDonough escribió:
>> Antonio Beamud Montero wrote:
>>> Can I force the flush of the output buffers in any way?
>> You might be able to run the process in "unbuffered" mode. The mechanism to do
>> this is different for each subprocess, but if e.g. your subprocess was a Python
>> program, you might do:
>>
>> python -u mysubprocess.py
>
> Ok, works fine.
> I was using:
>
> sys.stdout.write(line)
>
> And I thought that was sufficient, but I was wrong...
>
> I've changed the first line to:
>
> #!/usr/bin/python -u
>
> A lot of thanks, Chris.
>
>
FWIW, you could also probably do this every place you write to stdout rather
than using unbuffered mode:
sys.stdout.write(line)
sys.stdout.flush()
- C
More information about the Supervisor-users
mailing list