When using the python2.7 gzip module with StringIO, it’s extremely important to call GzipFile.close()
after you’ve finished writing to it. If you don’t, the archive will probably not be readable as the CRC record will not be appended, and you’ll get a bunch of IOErrors despite everything looking fine.