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


Groups > comp.lang.python > #8394

Re: unzip problem

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.002
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; '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; "'rb')": 0.16; 'chunk_size': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'zipfile': 0.16; 'cc:addr:python- list': 0.16; 'subject:problem': 0.19; 'to:2**1': 0.21; 'cc:2**0': 0.21; 'header:In-Reply-To:1': 0.22; 'code': 0.24; 'changed': 0.25; 'cc:addr:python.org': 0.30; 'thanks': 0.30; 'print': 0.32; 'header :User-Agent:1': 0.34; 'subject:: ': 0.38; 'data': 0.39; 'help': 0.39; 'skip:z 10': 0.40; 'your': 0.61; 'back': 0.63; 'received:websitewelcome.com': 0.65; 'here': 0.66; 'received:184': 0.67
Date Fri, 24 Jun 2011 11:55:52 -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> <4E04D0A2.5040102@stoneleaf.us> <9FF28245399DBC4F83C1BB6EA57CA4EC3609@EXCHVS01.ad.sfwmd.gov>
In-Reply-To <9FF28245399DBC4F83C1BB6EA57CA4EC3609@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]:3648
X-Source-Auth ethan+stoneleaf.us
X-Email-Count 1
X-Source-Cap dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ==
Cc Python <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.377.1308940857.1164.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 82.94.164.166
X-Trace 1308940858 news.xs4all.nl 181 [::ffff:82.94.164.166]:51100
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:8394

Show key headers only | View raw


Ahmed, Shakir wrote:
> 
> Thanks for your help and really appreciate your time.
> 
> I changed the code as you mentioned and here it is:
> 
> 
> fn = open('T:\\applications\\tst\\py\\Zip_Process\\Zip\\myzip.zip',
> 'rb')
> z = zipfile.ZipFile(fn)
> for name in z.namelist():

       data = z.read(name)

>     ptr = 0
>     size = len(name)  # change this back to data
                 ^- No.  You need the size of the data read in from the 
zipfile for that name, not the length of the name.  Sorry for the omission.

>     print size
>     print ptr
>     while ptr < size:
>         
>         fn.write(name[ptr:ptr+CHUNK_SIZE]) # change name to data
>         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:55 -0700

csiph-web