unzip problem - solved
Ethan Furman
ethan at stoneleaf.us
Fri Jun 24 16:21:55 EDT 2011
Ahmed, Shakir wrote:
> Here is the final code that worked to unzip a large file in the network
> drive.
>
> CHUNK_SIZE = 10 * 1024 * 1024
>
>
> fh = open('T:\\applications\\tst\\py\\Zip_Process\\Zip\\myzip.zip',
> 'rb')
> z = zipfile.ZipFile(fh)
> for name in z.namelist():
> fn = open(name, 'wb')
> ptr = 0
> data = z.read(name)
> size = len(name)
> print size
> print ptr
> while ptr < size:
> #fn.write(data)
> fn.write(data[ptr:ptr+CHUNK_SIZE])
> ptr += CHUNK_SIZE
> fn.close()
> fh.close()
The 'size = len(name)' should be 'size = len(data)'.
~Ethan~
More information about the Python-list
mailing list