From 5f8e5e0be9dd35e8a60705b7d59c72851e7d6994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Tue, 13 Aug 2013 10:48:42 +0200 Subject: [PATCH] Fixed tmp directories --- kcc/comic2ebook.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index de71e4b..bb531bb 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -598,8 +598,8 @@ def genEpubStruct(path): def getWorkFolder(afile): - workdir = tempfile.mkdtemp('', 'KCC-TMP-', os.path.join(os.path.splitext(afile)[0], '..')) if os.path.isdir(afile): + workdir = tempfile.mkdtemp('', 'KCC-TMP-', os.path.join(os.path.splitext(afile)[0], '..')) try: os.rmdir(workdir) # needed for copytree() fails if dst already exists fullPath = os.path.join(workdir, 'OEBPS', 'Images') @@ -613,10 +613,10 @@ def getWorkFolder(afile): pdf = pdfjpgextract.PdfJpgExtract(afile) path, njpg = pdf.extract() if njpg == 0: - rmtree(workdir) rmtree(path) raise UserWarning("Failed to extract images.") else: + workdir = tempfile.mkdtemp('', 'KCC-TMP-', os.path.splitext(afile)[0]) cbx = cbxarchive.CBxArchive(afile) if cbx.isCbxFile(): try: