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~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to