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


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

Re: unzip problem

Started byEthan Furman <ethan@stoneleaf.us>
First post2011-06-24 11:00 -0700
Last post2011-06-24 11:00 -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:00 -0700

#8391 — Re: unzip problem

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

[toc] | [standalone]


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


csiph-web