Extracting file from zip archive in Python 2.6.1

Brandon Taylor btaylordesign at gmail.com
Tue Feb 3 02:31:24 EST 2009


Hello everyone,

I'm having an issue specifying the path for extracting files from
a .zip archive. In my method, I have:

zip_file.extract(zip_name + '/' + thumbnail_image, thumbnail_path)

What is happening is that the extract method is creating a folder with
the name of 'zip_name' and extracting the files to it. Example:

if 'thumbnail_path' is 'images/inventory/thumbnails/'

extract is creating: 'images/inventory/thumbnails/test1/'

and saving the files out. How can I set the path to be exactly:
'images/inventory/thumbnails'  ?

TIA,
Brandon



More information about the Python-list mailing list