Extracting .zip files with Python
Ray Parrish
crp at cmc.net
Sat Mar 6 04:14:12 UTC 2010
Hello,
Here I am stuck again... 8-) Here's my code as ran in the interpreter,
and the errors -
>>> ThisZip = zipfile.ZipFile("/home/ray/logs/IIS/ex100102.zip", "r")
>>> List = ThisZip.namelist()
>>> List[0]
'ex100102.log'
>>> ArchiveName = List[0]
>>> ThisZip.extract(ArchiveName,"/home/ray/logs/IIS/" + ArchiveName)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: ZipFile instance has no attribute 'extract'
>>> FileHandle = ThisZip.open(ArchiveName,"r")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: ZipFile instance has no attribute 'open'
I think the documents actually said that .extract() was a Python 2.6
thing, and since I'm on Python 2.5 I guess it doesn't have that, but it
should have .open() as it was listed above the 2.6 version seperation in
the docs.
Can you please tell me what I'm doing wrong, and give me some pointers
on extracting .zip files with the Python zipfile class?
Thanks, Ray Parrish
--
Linux dpkg Software Report script set..
http://www.rayslinks.com/LinuxdpkgSoftwareReport.html
Ray's Links, a variety of links to usefull things, and articles by Ray.
http://www.rayslinks.com
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.
http://www.writingsoftheschizophrenic.com
More information about the ubuntu-users
mailing list