From d5ff7f7db9f0dd1dcb0012d25def8186a4f0fe21 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Tue, 21 May 2024 01:52:57 -0700 Subject: [PATCH] batch: fix issues flagged by ruff --- misc/batch.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/misc/batch.py b/misc/batch.py index 5ba27a5fb..a9e45ac23 100644 --- a/misc/batch.py +++ b/misc/batch.py @@ -14,12 +14,12 @@ from __future__ import annotations +import filecmp import logging -import sys import os import posixpath import shutil -import filecmp +import sys from pathlib import Path import ocrmypdf @@ -70,7 +70,7 @@ def filecompare(a, b): logging.info(f"Archiving document to {archive_filename}") try: shutil.copy2(filename, posixpath.dirname(archive_filename)) - except IOError as io_err: + except OSError: os.makedirs(posixpath.dirname(archive_filename)) shutil.copy2(filename, posixpath.dirname(archive_filename)) try: @@ -86,6 +86,6 @@ def filecompare(a, b): logging.info( "Skipped document because it does not need ocr as it is tagged" ) - except: + except Exception: logging.error("Unhandled error occured") logging.info("OCR complete")