Forums

unintended decompression with gzipped file

From the PythonAnywhere Files tab I downloaded a gzipped CSV file using in Google Chrome 52 on Windows 7. Strangely the downloaded file had the same name (like foo.csv.gz), but it was uncompressed. That is, the downloaded size was about 10x bigger, and after renaming it to foo.csv, I could open it in Excel.

That's weird. Maybe the file was never gzipped but was just named incorrectly?

On pythonanywhere.com the size is about 200KB, while after downloading on Windows the size is about 2000KB, so it was actually compressed on pythonanywhere.com

I think it has to do with how gzip compression is often used (or in this case misused) to transmit web pages over HTTP

Hmm, interesting point. We set the content-type header on files that you download based on their contents. This works really well for images, but perhaps isn't ideal for gzipped files, as your browser is presumably automatically decompressing it when it sees the header.

Not quite sure what we should do here. We don't want to cause problems for people who just want to view images they've generated (a pretty common use case is that someone generates a chart of some data using matplotlib and then wants to view it). But the situation you're seeing is also far from ideal. Perhaps we could not set the content type for gzipped files?

OK, I just wanted you to be aware. Personally for me it's a very minor issue

Overall Pythonanywhere is awesome! :)