From 15f151f5fe8d07631a0b3e9bcd4d1bb3e117c4d5 Mon Sep 17 00:00:00 2001 From: Lukas Metzger Date: Sat, 7 Sep 2024 16:39:06 +0000 Subject: [PATCH] Changed to use pathlib.Path --- src/documents/barcodes.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/documents/barcodes.py b/src/documents/barcodes.py index 1d3870be6..8d00117f6 100644 --- a/src/documents/barcodes.py +++ b/src/documents/barcodes.py @@ -1,5 +1,4 @@ import logging -import os import re import tempfile from dataclasses import dataclass @@ -263,8 +262,8 @@ class BarcodePlugin(ConsumeTaskPlugin): )[0] # Remember filename, since it is lost by upscaling - page_filename = page.filename - logger.debug(f"Image is at {page_filename}") + page_filepath = Path(page.filename) + logger.debug(f"Image is at {page_filepath}") # Upscale image if configured factor = settings.CONSUMER_BARCODE_UPSCALE @@ -284,7 +283,7 @@ class BarcodePlugin(ConsumeTaskPlugin): ) # Delete temporary image file - os.remove(page_filename) + page_filepath.unlink() # Password protected files can't be checked # This is the exception raised for those