Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extract_page_paragraphs TypeError: 'map' object is not subscriptable #2

Open
walidbou6 opened this issue Aug 21, 2023 · 0 comments
Open

Comments

@walidbou6
Copy link

trying the following script got me an error:

from depdf import DePDF
import depdf

pdf = DePDF.load(pdfs[0])
pars = depdf.extract_page_paragraphs(pdf, 1)

ERROR:

File ~.virtualenvs\develop_metrics-2tt3ZQrv\Lib\site-packages\pdfplumber\display.py:65, in PageImage.init(self, page, original, resolution)
58 if cropped:
59 cropbox = (
60 (page.bbox[0] - page.root_page.bbox[0]) * self.scale,
61 (page.bbox[1] - page.root_page.bbox[1]) * self.scale,
62 (page.bbox[2] - page.root_page.bbox[0]) * self.scale,
63 (page.bbox[3] - page.root_page.bbox[1]) * self.scale,
64 )
---> 65 self.original = self.original.crop(map(int, cropbox))
66 self.reset()

File ~.virtualenvs\develop_metrics-2tt3ZQrv\Lib\site-packages\PIL\Image.py:1199, in Image.crop(self, box)
1196 if box is None:
1197 return self.copy()
-> 1199 if box[2] < box[0]:
1200 msg = "Coordinate 'right' is less than 'left'"
1201 raise ValueError(msg)

TypeError: 'map' object is not subscriptable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant