Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8390
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <shahmed@sfwmd.gov> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'received:141': 0.03; 'skip:p 40': 0.04; 'skip:[ 50': 0.07; 'ioerror:': 0.09; 'exception': 0.12; 'message-----': 0.12; 'am,': 0.13; 'debugging': 0.13; 'wrote:': 0.15; "'rb')": 0.16; 'semanchuk': 0.16; 'unhandled': 0.16; '16,': 0.16; '>>>': 0.16; 'happening': 0.19; 'subject:problem': 0.19; 'to:2**1': 0.21; '(most': 0.21; 'header :In-Reply-To:1': 0.22; 'code': 0.24; 'traceback': 0.25; 'skip:" 30': 0.28; 'script': 0.29; '24,': 0.29; 'problem': 0.29; 'hi,': 0.30; 'subject:': 0.30; 'print': 0.32; 'file.': 0.32; 'error': 0.33; 'list': 0.33; 'sent:': 0.34; 'to:addr:python-list': 0.34; "can't": 0.34; 'last):': 0.35; 'file': 0.36; 'charset:us-ascii': 0.36; 'idea': 0.36; 'from:': 0.36; 'skip:o 20': 0.36; 'friday,': 0.37; 'getting': 0.38; 'subject:: ': 0.38; 'two': 0.38; 'data': 0.39; 'help': 0.39; 'got': 0.39; 'to:addr:python.org': 0.39; 'appreciated.': 0.40; 'skip:z 10': 0.40; 'here:': 0.64; 'zip': 0.65; 'here': 0.66; '"for': 0.67; 'jun': 0.67; 'june': 0.69; 'luck': 0.73; '10:55': 0.84; '11:18': 0.84 |
| X-MimeOLE | Produced By Microsoft Exchange V6.5 |
| Content-class | urn:content-classes:message |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset="us-ascii" |
| Content-Transfer-Encoding | quoted-printable |
| Subject | RE: unzip problem |
| Date | Fri, 24 Jun 2011 13:31:51 -0400 |
| In-Reply-To | <DE166BE5-7A44-41A7-970C-513EDD2D7402@semanchuk.com> |
| X-MS-Has-Attach | |
| X-MS-TNEF-Correlator | |
| Thread-Topic | unzip problem |
| Thread-Index | AcwyhjojGsI4L/9qRJuGcw55UHsSmwADehKw |
| References | <9FF28245399DBC4F83C1BB6EA57CA4EC3601@EXCHVS01.ad.sfwmd.gov> <DE166BE5-7A44-41A7-970C-513EDD2D7402@semanchuk.com> |
| From | "Ahmed, Shakir" <shahmed@sfwmd.gov> |
| To | "Philip Semanchuk" <philip@semanchuk.com>, "Lista-Comp-Lang-Python list" <python-list@python.org> |
| X-Virus-Scanned | ClamAV 0.96.1/13237/Fri Jun 24 09:50:33 2011 |
| X-Virus-Status | Clean |
| X-Scanned-By | MIMEDefang 2.70 on 141.232.3.26 |
| 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.374.1308936713.1164.python-list@python.org> (permalink) |
| Lines | 107 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1308936713 news.xs4all.nl 182 [::ffff:82.94.164.166]:54225 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:8390 |
Show key headers only | View raw
-----Original Message-----
From: python-list-bounces+shahmed=sfwmd.gov@python.org
[mailto:python-list-bounces+shahmed=sfwmd.gov@python.org] On Behalf Of
Philip Semanchuk
Sent: Friday, June 24, 2011 11:18 AM
To: Lista-Comp-Lang-Python list
Subject: Re: unzip problem
On Jun 24, 2011, at 10:55 AM, 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')
Start debugging with these two steps --
1) Add this just after "for name in z.namelist():"
print name
That way you can tell which file is failing.
2) You can't tell whether you're getting an error on the write or the
read because you've got two statements combined into one line. Change
this --
outfile.write(z.read(name))
to this --
data = z.read(name)
outfile.write(data)
Good luck
Philip
>
>
>
>
>
> The script is here:
>
> *****************************
>
> fh = open('T:\\test\\*.zip', 'rb')
>
> z = zipfile.ZipFile(fh)
>
> for name in z.namelist():
>
> outfile = open(name, 'wb')
>
>
>
> outfile.write(z.read(name))
>
> print z
>
> print outfile
>
> outfile.close()
>
>
>
> fh.close()
>
> ********************************
The problem found in outfile.Write. The error code is here and is
happening when few of the files are already unzipped from the zip file
>>> T:\applications\tst\py\Zip_Process
>>> drg100.aux
>>> <zipfile.ZipFile instance at 0x00E2F648>
>>> <open file 'drg100.aux', mode 'wb' at 0x00E12608>
>>> drg100.fgdc.htm
>>> <zipfile.ZipFile instance at 0x00E2F648>
>>> <open file 'drg100.fgdc.htm', mode 'wb' at 0x00E128D8>
>>> drg100.htm
>>> <zipfile.ZipFile instance at 0x00E2F648>
>>> <open file 'drg100.htm', mode 'wb' at 0x00E12608>
>>> drg100.sdw
>>> <zipfile.ZipFile instance at 0x00E2F648>
>>> <open file 'drg100.sdw', mode 'wb' at 0x00E128D8>
>>> drg100.sid
>>> Unhandled exception while debugging...
Traceback (most recent call last):
File "C:\Zip_Process\py\test2_new.py", line 16, in <module>
outfile.write(data)
IOError: (22, 'Invalid argument')
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
RE: unzip problem "Ahmed, Shakir" <shahmed@sfwmd.gov> - 2011-06-24 13:31 -0400
csiph-web