From 9b7500375b6bb226e53da2967b1dfb4881d2444c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 5 Aug 2008 07:57:45 -0700 Subject: [PATCH] Fix #924 (CBZ Convert Error) --- src/calibre/utils/zipfile.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/utils/zipfile.py b/src/calibre/utils/zipfile.py index 02f7eac5c4..ff31210444 100644 --- a/src/calibre/utils/zipfile.py +++ b/src/calibre/utils/zipfile.py @@ -1028,11 +1028,13 @@ class ZipFile: # Create all upper directories if necessary. upperdirs = os.path.dirname(targetpath) + if upperdirs and not os.path.isdir(upperdirs): + os.unlink(upperdirs) if upperdirs and not os.path.exists(upperdirs): os.makedirs(upperdirs) - + source = self.open(member, pwd=pwd) - target = file(targetpath, "wb") + target = open(targetpath, "wb") shutil.copyfileobj(source, target) source.close() target.close()