unzip problem
Ethan Furman
ethan at stoneleaf.us
Fri Jun 24 14:00:02 EDT 2011
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~
More information about the Python-list
mailing list