batch: fix issues flagged by ruff

This commit is contained in:
James R. Barlow
2024-05-21 01:52:57 -07:00
parent 579cef3649
commit d5ff7f7db9
+4 -4
View File
@@ -14,12 +14,12 @@ You should edit this script to meet your needs.
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 @@ for filename in start_dir.glob("**/*.pdf"):
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 @@ for filename in start_dir.glob("**/*.pdf"):
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")