python-zipstream icon indicating copy to clipboard operation
python-zipstream copied to clipboard

Can Not Unzip

Open David-Lee-1990 opened this issue 5 years ago • 1 comments

Hi, thanks for your contribution. I build a service, which serve a zip file to download, using webpy. I can successfully download the zip file, but I cannot unzip it. How can I solve this?

I use the same code as follows.

def GET(self): path = '/path/to/dir/of/files' zip_filename = 'files.zip' web.header('Content-type' , 'application/zip') web.header('Content-Disposition', 'attachment; filename="%s"' % ( zip_filename,)) return zipstream.ZipFile(path)

David-Lee-1990 avatar Sep 27 '20 09:09 David-Lee-1990

Hi @David-Lee-1990 I'm afraid the example you're using seems to be incorrect. It was copied along with the rest from the original zipstream package, but looking at the code, it doesn't seem like it can work. As far as I understand it, the constructor can only be used to pass the location of an actual ZIP file to be read or written.

Please take a look at the relatively simple Django example in the README for the correct way to use the library.

I'll try to fix the webpy example sometime soon.

arjan-s avatar Sep 30 '20 09:09 arjan-s