Truncated file without unbuffered mode

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top