Index: Lib/zipfile.py =================================================================== --- Lib/zipfile.py (version 67893) +++ Lib/zipfile.py (working copy) @@ -954,13 +954,22 @@ else: targetpath = os.path.join(targetpath, member.filename) + isdir = False + + if targetpath[-1:] == "/": + isdir = True + targetpath = os.path.normpath(targetpath) # Create all upper directories if necessary. upperdirs = os.path.dirname(targetpath) - if upperdirs and not os.path.exists(upperdirs): + if upperdirs and not os.path.isdir(upperdirs): os.makedirs(upperdirs) + if isdir: + os.mkdir(targetpath) + return targetpath + source = self.open(member, pwd=pwd) target = file(targetpath, "wb") shutil.copyfileobj(source, target)