read Zipfile

Tim Chase python.list at tim.thechases.com
Tue Nov 3 02:02:52 CET 2009


>> 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 "<stdin>", line 1, in ?
>> AttributeError: ZipFile instance has no attribute 'open'
> 
> ZipFile.open(name[, mode[, pwd]])
> [...]
>     New in version 2.6.
> 
> Would your Python version happen to be pre-2.6?

FWIW, you can use the 2.6 zipfile.py as far back as 2.4 by just 
copying it into your project directory.  I had a similar issue in 
2.4 (wanted the iterator provided by 2.6's open() call) and 
Gabriel suggested trying to just copy in the 2.6 version into my 
project directory.  Worked for me(tm).

-tkc





More information about the Python-list mailing list