Skip to content

Commit 781ce85

Browse files
authored
Fix local pdf loading (#7466)
fix local pdf loading
1 parent d6d0281 commit 781ce85

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/datasets/features/pdf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ def decode_example(self, value: dict, token_per_repo_id=None) -> "pdfplumber.pdf
164164
raise ValueError(f"A pdf should have one of 'path' or 'bytes' but both are None in {value}.")
165165
else:
166166
if is_local_path(path):
167-
with pdfplumber.open(path) as p:
168-
pdf = p
167+
pdf = pdfplumber.open(path)
169168
else:
170169
source_url = path.split("::")[-1]
171170
pattern = (

0 commit comments

Comments
 (0)