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


Groups > comp.lang.python > #8391

Re: unzip problem

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ethan@stoneleaf.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'ioerror:': 0.09; 'message-id:@stoneleaf.us': 0.09; 'ptr': 0.09; 'received:gator410.hostgator.com': 0.09; '~ethan~': 0.09; 'skip:f 30': 0.13; 'wrote:': 0.15; '1024': 0.16; 'chunk_size': 0.16; 'pops': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'received:gateway01.websitewelcome.com': 0.16; 'cc:addr:python- list': 0.16; 'subject:problem': 0.19; 'to:2**1': 0.21; '(most': 0.21; 'cc:2**0': 0.21; 'cc:no real name:2**0': 0.22; 'header:In- Reply-To:1': 0.22; 'traceback': 0.25; 'skip:" 30': 0.28; 'problem': 0.29; 'cc:addr:python.org': 0.30; '(just': 0.30; 'hi,': 0.30; 'file.': 0.32; 'error': 0.33; 'header:User-Agent:1': 0.34; 'last):': 0.35; 'file': 0.36; 'idea': 0.36; 'skip:o 20': 0.36; 'getting': 0.38; 'subject:: ': 0.38; 'problems': 0.38; 'help': 0.39; 'appreciated.': 0.40; 'received:websitewelcome.com': 0.65; 'received:184': 0.67; 'dealt': 0.91; 'drive.': 0.91
Date Fri, 24 Jun 2011 11:00:02 -0700
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version 1.0
To "Ahmed, Shakir" <shahmed@sfwmd.gov>
Subject Re: unzip problem
References <9FF28245399DBC4F83C1BB6EA57CA4EC3601@EXCHVS01.ad.sfwmd.gov>
In-Reply-To <9FF28245399DBC4F83C1BB6EA57CA4EC3601@EXCHVS01.ad.sfwmd.gov>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - gator410.hostgator.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - stoneleaf.us
X-BWhitelist no
X-Source
X-Source-Args
X-Source-Dir
X-Source-Sender mail.admailinc.com ([192.168.10.136]) [72.11.125.166]:3490
X-Source-Auth ethan+stoneleaf.us
X-Email-Count 1
X-Source-Cap dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ==
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.375.1308937574.1164.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 82.94.164.166
X-Trace 1308937574 news.xs4all.nl 185 [::ffff:82.94.164.166]:45562
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:8391

Show key headers only | 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