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


Groups > comp.lang.python > #8394 > unrolled thread

Re: unzip problem

Started byEthan Furman <ethan@stoneleaf.us>
First post2011-06-24 11:55 -0700
Last post2011-06-24 11:55 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#8394 — Re: unzip problem

FromEthan Furman <ethan@stoneleaf.us>
Date2011-06-24 11:55 -0700
SubjectRe: unzip problem
Message-ID<mailman.377.1308940857.1164.python-list@python.org>
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~

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web