Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8394

Re: unzip problem

Date 2011-06-24 11:55 -0700
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: unzip problem
References <9FF28245399DBC4F83C1BB6EA57CA4EC3601@EXCHVS01.ad.sfwmd.gov> <4E04D0A2.5040102@stoneleaf.us> <9FF28245399DBC4F83C1BB6EA57CA4EC3609@EXCHVS01.ad.sfwmd.gov>
Newsgroups comp.lang.python
Message-ID <mailman.377.1308940857.1164.python-list@python.org> (permalink)

Show all headers | View raw


Ahmed, Shakir wrote:
> 
> Thanks for your help and really appreciate your time.
> 
> I changed the code as you mentioned and here it is:
> 
> 
> fn = open('T:\\applications\\tst\\py\\Zip_Process\\Zip\\myzip.zip',
> 'rb')
> z = zipfile.ZipFile(fn)
> for name in z.namelist():

       data = z.read(name)

>     ptr = 0
>     size = len(name)  # change this back to data
                 ^- No.  You need the size of the data read in from the 
zipfile for that name, not the length of the name.  Sorry for the omission.

>     print size
>     print ptr
>     while ptr < size:
>         
>         fn.write(name[ptr:ptr+CHUNK_SIZE]) # change name to data
>         ptr += CHUNK_SIZE
> 
> fn.close()

~Ethan~

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: unzip problem Ethan Furman <ethan@stoneleaf.us> - 2011-06-24 11:55 -0700

csiph-web