Re: read Zipfile

2009-11-02 Thread Tim Chase
Looks like you'd have to use the more primitive .read() method: http://docs.python.org/library/zipfile.html#zipfile.ZipFile.read Unfortunately, the ZipFile.read() reads the entire content. One of the main reasons to zip things is that they're big -- possibly too big to fit conveniently in mem

Re: read Zipfile

2009-11-02 Thread Tim Chase
I would like to know how does python 2.4 work for my case w/o the new added feature in 2.6? Do you guys know? You can just grab the zipfile.py file from within the 2.6 distribution[1] and dump it in your project folder. Python should find it before it finds the 2.4 version in the $PYTHONPATH

Re: read Zipfile

2009-11-02 Thread Chris Rebert
> On Mon, Nov 2, 2009 at 5:02 PM, Tim Chase > wrote: I would like to open the csv file with folowwing command, file=archive.open("CHAVI_MACS_SC_A__AUG_25_08_FinalReport_090812.csv","r") But it turned out error, Traceback (most recent call last):  File "", line 1,

Re: read Zipfile

2009-11-02 Thread sityee kong
Hi all, yes, im using python 2.4. I would like to know how does python 2.4 work for my case w/o the new added feature in 2.6? Do you guys know? thanks! On Mon, Nov 2, 2009 at 5:02 PM, Tim Chase wrote: > I would like to open the csv file with folowwing command, >>> >>> file=archive.open("CHAVI_

Re: read Zipfile

2009-11-02 Thread Gabriel Genellina
En Mon, 02 Nov 2009 20:39:07 -0300, sityee kong escribió: However for the ZIP file, let says the ZIP file contains only one member, archive.namelist() ['CHAVI_MACS_SC_A__AUG_25_08_FinalReport_090812.csv'] I would like to open the csv file with folowwing command, file=archive.open("CHAVI_MA

Re: read Zipfile

2009-11-02 Thread Tim Chase
I would like to open the csv file with folowwing command, file=archive.open("CHAVI_MACS_SC_A__AUG_25_08_FinalReport_090812.csv","r") But it turned out error, Traceback (most recent call last): File "", line 1, in ? AttributeError: ZipFile instance has no attribute 'open' ZipFile.open(name[, m

Re: read Zipfile

2009-11-02 Thread Chris Rebert
On Mon, Nov 2, 2009 at 4:39 PM, sityee kong wrote: > However for the ZIP file, let says the ZIP file contains only one member, archive.namelist() > ['CHAVI_MACS_SC_A__AUG_25_08_FinalReport_090812.csv'] > > I would like to open the csv file with folowwing command, > file=archive.open("CHAVI_M

read Zipfile

2009-11-02 Thread sityee kong
Hi all, I'm writing a program to manipulate data in 3 different kind of format, there are GZIP, cvs/txt, or ZIP file. Here is part of my program to open these 3 kind formats of file, if (option==1): file=gzip.GzipFile(sys.argv[1],"r") elif (option==2): file=open(sys.argv[1],"r")

Re: read zipfile sequentially?

2008-10-15 Thread Alan G Isaac
On 10/15/2008 3:13 PM Tim Chase apparently wrote: http://mail.python.org/pipermail/python-list/2007-December/469320.html Ask and ye shall receive... Thank you! Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: read zipfile sequentially?

2008-10-15 Thread Tim Chase
I have a large ASCII data set that is zipped to a reasonable size. Can I access the data without decompressing the whole file first? I would like to run through the data to produce a much smaller extract and some summary statistics, but without unzipping it (if that is even possible). Yes, if yo

read zipfile sequentially?

2008-10-15 Thread Alan G Isaac
I have a large ASCII data set that is zipped to a reasonable size. Can I access the data without decompressing the whole file first? I would like to run through the data to produce a much smaller extract and some summary statistics, but without unzipping it (if that is even possible). Thanks, Alan