F
Fuzzyman
I use a simple python script to monitor downloads from my website.
http://www.voidspace.org.uk/python/cgi.shtml#downman
It serves the file in a loop using our old friend :
``sys.stdout.write(chunk)``
(After sending the relevant headers with filename and filesize of
course).
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 ?
Regards,
Fuzzy
http://www.voidspace.org.uk/python/index.shtml
http://www.voidspace.org.uk/python/cgi.shtml#downman
It serves the file in a loop using our old friend :
``sys.stdout.write(chunk)``
(After sending the relevant headers with filename and filesize of
course).
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 ?
Regards,
Fuzzy
http://www.voidspace.org.uk/python/index.shtml