Truncated file without unbuffered mode

Fuzzyman fuzzyman at
Tue Mar 15 08:04:10 EST 2005

I use a simple python script to monitor downloads from my website.

It serves the file in a loop using our old friend :


(After sending the relevant headers with filename and filesize of

I am testing this 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 why this might happen ?



More information about the Python-list mailing list