From 1ee15503f4e1ef038d9b4028a6ea9a1beff298c0 Mon Sep 17 00:00:00 2001 From: "atp (Open ERP)" Date: Tue, 7 Dec 2010 17:35:25 +0530 Subject: [PATCH] [FIX]: Closes Popen descriptors in document. bzr revid: atp@tinyerp.co.in-20101207120525-2825qhtdbo6kgk0v --- addons/document/std_index.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/addons/document/std_index.py b/addons/document/std_index.py index 7cfcd36e2dc..ca5b02eef55 100644 --- a/addons/document/std_index.py +++ b/addons/document/std_index.py @@ -96,12 +96,7 @@ class DocIndex(indexer): def _doIndexFile(self,fname): fp = Popen(['antiword', fname], shell=False, stdout=PIPE).stdout - try: - file_data = _to_unicode(fp.read()) - finally: - fp.close() - - return file_data + return _to_unicode(fp.read()) cntIndex.register(DocIndex()) @@ -163,12 +158,7 @@ class PdfIndex(indexer): def _doIndexFile(self,fname): fp = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE).stdout - try: - file_data = _to_unicode( fp.read()) - finally: - fp.close() - - return file_data + return _to_unicode( fp.read()) cntIndex.register(PdfIndex())