We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 156bf88 commit a863d00Copy full SHA for a863d00
pipelines/pipelines/nodes/file_converter/pdf.py
@@ -209,9 +209,13 @@ def convert(
209
try:
210
images = convert_from_path(file_path)
211
for image in images:
212
- temp_img = tempfile.NamedTemporaryFile(dir=os.path.dirname(os.path.realpath(__file__)), suffix=".jpeg")
+ temp_img = tempfile.NamedTemporaryFile(
213
+ dir=os.path.dirname(os.path.realpath(__file__)), suffix=".jpeg", delete=False
214
+ )
215
image.save(temp_img.name)
216
pages.append(self.image_2_text.convert(temp_img.name)[0]["content"])
217
+ temp_img.close()
218
+ os.remove(temp_img.name)
219
except Exception as exception:
220
logger.error(f"File {file_path} has an error \n {exception}")
221
0 commit comments