From 79c5d948b57510dbc70a15d8e9c30cc3d10b9ea4 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 3 Jan 2022 12:33:15 +0100 Subject: [PATCH] close filedescriptor after use --- pandora/document/fulltext.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora/document/fulltext.py b/pandora/document/fulltext.py index 40ff52be2..1872b9ce3 100644 --- a/pandora/document/fulltext.py +++ b/pandora/document/fulltext.py @@ -19,10 +19,11 @@ def extract_text(pdf, page=None): # split page from pdf and ocr fd, page_pdf = tempfile.mkstemp('.pdf') cmd = ['pdfseparate', '-f', page, '-l', page, pdf, page_pdf] - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) stdout, stderr = p.communicate() text = ocr_image(page_pdf) os.unlink(page_pdf) + os.close(fd) return text else: return ocr_image(pdf)