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())