[ocrfeeder] Create a temporary directory correctly for the PDF conversion
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ocrfeeder] Create a temporary directory correctly for the PDF conversion
- Date: Fri, 28 Oct 2011 17:18:41 +0000 (UTC)
commit 248b1c3971d839fe584fc5eb1ae73e83cb03d56f
Author: Joaquim Rocha <jrocha igalia com>
Date: Fri Oct 28 18:58:03 2011 +0200
Create a temporary directory correctly for the PDF conversion
It was generating a temporary file, removing it and creating
a temporary directory instead of using the function that directly
creates the temporary folder (tempfile.mkdtemp).
src/ocrfeeder/util/lib.py | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
---
diff --git a/src/ocrfeeder/util/lib.py b/src/ocrfeeder/util/lib.py
index 19d0031..15eeb68 100644
--- a/src/ocrfeeder/util/lib.py
+++ b/src/ocrfeeder/util/lib.py
@@ -41,12 +41,7 @@ def getIconOrLabel(icon_name, label_text, icon_size = gtk.ICON_SIZE_SMALL_TOOLBA
return icon, label
def convertPdfToImages(pdf_file, temp_dir = '/tmp'):
- dir_name = tempfile.mkstemp(dir = temp_dir)[1]
- try:
- os.remove(dir_name)
- os.mkdir(dir_name)
- except:
- pass
+ dir_name = tempfile.mkdtemp(dir = temp_dir)
debug('Converting PDF: ', pdf_file, ' to image')
resolution = 300
file_name = os.path.splitext(os.path.basename(pdf_file))[0]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]