From 7fb44378e145121e35b63c6c731303519a2b763f Mon Sep 17 00:00:00 2001 From: Quentin Lhoest Date: Tue, 18 Mar 2025 15:08:37 +0100 Subject: [PATCH] fix local pdf loading --- src/datasets/features/pdf.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/datasets/features/pdf.py b/src/datasets/features/pdf.py index 75c6f2ee73e..db0b981eac5 100644 --- a/src/datasets/features/pdf.py +++ b/src/datasets/features/pdf.py @@ -164,8 +164,7 @@ def decode_example(self, value: dict, token_per_repo_id=None) -> "pdfplumber.pdf raise ValueError(f"A pdf should have one of 'path' or 'bytes' but both are None in {value}.") else: if is_local_path(path): - with pdfplumber.open(path) as p: - pdf = p + pdf = pdfplumber.open(path) else: source_url = path.split("::")[-1] pattern = (