Skip to content

Commit 5f09f06

Browse files
authored
chore: Remove warning logs from pypdf (#148)
When we load a PdfReader with `strict=False`, we can get warnings from pypdf. Unless an error is thrown, these do not affect processing, so let's just suppress the pypdf log level.
1 parent 85c5b02 commit 5f09f06

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: src/unstructured_client/_hooks/custom/pdf_utils.py

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010

1111
logger = logging.getLogger(UNSTRUCTURED_CLIENT_LOGGER_NAME)
1212

13+
# Loading pdfs with strict=False can dump a lot of warnings
14+
# We don't need to display these
15+
pdf_logger = logging.getLogger("pypdf")
16+
pdf_logger.setLevel(logging.ERROR)
17+
1318

1419
def get_pdf_pages(
1520
pdf: PdfReader, split_size: int = 1, page_start: int = 1, page_end: Optional[int] = None

0 commit comments

Comments
 (0)