[FIX]: Closes Popen descriptors in document.

bzr revid: atp@tinyerp.co.in-20101207120525-2825qhtdbo6kgk0v
This commit is contained in:
atp (Open ERP) 2010-12-07 17:35:25 +05:30
parent f981dd322d
commit 1ee15503f4
1 changed files with 2 additions and 12 deletions

View File

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