Fix #924 (CBZ Convert Error)

This commit is contained in:
Kovid Goyal 2008-08-05 07:57:45 -07:00
parent 6eb005d5c6
commit 9b7500375b

View File

@ -1028,11 +1028,13 @@ class ZipFile:
# Create all upper directories if necessary. # Create all upper directories if necessary.
upperdirs = os.path.dirname(targetpath) upperdirs = os.path.dirname(targetpath)
if upperdirs and not os.path.isdir(upperdirs):
os.unlink(upperdirs)
if upperdirs and not os.path.exists(upperdirs): if upperdirs and not os.path.exists(upperdirs):
os.makedirs(upperdirs) os.makedirs(upperdirs)
source = self.open(member, pwd=pwd) source = self.open(member, pwd=pwd)
target = file(targetpath, "wb") target = open(targetpath, "wb")
shutil.copyfileobj(source, target) shutil.copyfileobj(source, target)
source.close() source.close()
target.close() target.close()