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


Groups > comp.lang.python > #8391

Re: unzip problem

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

Show all headers | View raw


Ahmed, Shakir wrote:
> Hi,
> 
>  
> 
> I am getting following error message while unziping a .zip file. Any
> help or idea is highly appreciated.
> 
>  
> 
> Error message>>>
> 
> Traceback (most recent call last):
> 
>   File "C:\Zip_Process\py\test2_new.py", line 15, in <module>
> 
>     outfile.write(z.read(name))
> 
> IOError: (22, 'Invalid argument')

I just dealt with this problem on my system -- only pops up when writing 
large files (just over 50Mb for me) to a network drive; no problems when 
writing to a local drive.

Here's how I get around it:

     CHUNK_SIZE = 10 * 1024 * 1024

     fn = open(uncompressed_file, 'wb')
     ptr = 0
     size = len(data)
     while ptr < size:
         fn.write(data[ptr:ptr+CHUNK_SIZE])
         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:00 -0700

csiph-web