w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Getting corrupt zips using Python ZipStream in Django

You should close the ZipFile when you're done writing to it. Otherwise, to quote the documentation, "essential records will not be written" until you do.

The cleanest way to do it is using the with statement:

with zipstream.ZipFile(mode='w',
compression=zipstream.ZIP_DEFLATED) as zf:
    # ...write to zf...




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.