This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: zipfile: Extracting a directory that already exists generates an OSError
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.1, Python 2.7
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: loewis Nosy List: benjamin.peterson, ezio.melotti, joe.amenta, loewis
Priority: release blocker Keywords: patch

Created on 2009-05-18 05:01 by joe.amenta, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
zipdiff.diff joe.amenta, 2009-05-18 05:01 extract() tests if dir exists, does not try to os.mkdir if it already does.
Messages (4)
msg88014 - (view) Author: Joe Amenta (joe.amenta) Date: 2009-05-18 05:01
zipfile.ZipFile.extract() fails if targetpath is a directory that
already exists.

Bug revealed itself on Ubuntu, using extractall().

Happened on the latest 3.1 and 2.7.

Attached a patch that I think will fix this issue.
msg88243 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-05-23 17:10
It would be nice to have a test with the patch.
msg88277 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-05-24 19:55
Thanks for the patch. Committed with modifications (including a test) as
r72893, r72894, r72895, r72896.
msg111962 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2010-07-29 16:35
#9172 has been closed as duplicate of this.
History
Date User Action Args
2022-04-11 14:56:49adminsetgithub: 50300
2010-07-29 16:35:15ezio.melottisetnosy: + ezio.melotti
messages: + msg111962

type: behavior
stage: resolved
2009-05-24 19:55:45loewissetstatus: open -> closed
resolution: accepted
messages: + msg88277
2009-05-23 17:10:37benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg88243
2009-05-18 06:14:51loewissetpriority: release blocker
assignee: loewis

nosy: + loewis
2009-05-18 05:01:40joe.amentacreate