Skip to content

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

@walidbou6

Description

@walidbou6

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions