pdfplumber icon indicating copy to clipboard operation
pdfplumber copied to clipboard

pdfplumber verison 0.11.3 happen error "TypeError: 'type' object is not subscriptable"

Open Akiramex opened this issue 2 years ago • 2 comments

When I use the latest pdfplumber verison 0.11.3. to run my program,the bug happen。

Traceback (most recent call last): File "run.py", line 5, in from pdf import pdf2mats File "C:\Users\sinow\Desktop\dsimgocr\dsimgocr\src\pdf.py", line 1, in import pdfplumber File "C:\env\anaconda3\envs\imgocr\lib\site-packages\pdfplumber_init_.py", line 15, in from .pdf import PDF File "C:\env\anaconda3\envs\imgocr\lib\site-packages\pdfplumber\pdf.py", line 17, in from .page import Page File "C:\env\anaconda3\envs\imgocr\lib\site-packages\pdfplumber\page.py", line 35, in from .table import T_table_settings, Table, TableFinder, TableSettings File "C:\env\anaconda3\envs\imgocr\lib\site-packages\pdfplumber\table.py", line 377, in class Table(object): File "C:\env\anaconda3\envs\imgocr\lib\site-packages\pdfplumber\table.py", line 392, in Table def _get_rows_or_cols(self, kind: type[CellGroup]) -> List[CellGroup]: TypeError: 'type' object is not subscriptable

But when i use the version 0.11.2,the program can run nomal.

Akiramex avatar Aug 13 '24 06:08 Akiramex

type[CellGroup] looks like python 3.9 syntax (https://docs.python.org/3.9/whatsnew/3.9.html#type-hinting-generics-in-standard-collections), I'd assume you see this bug on Python 3.8 (which the setup.py lists as compatible)

andrekeller avatar Aug 13 '24 13:08 andrekeller

Thanks for flagging @Akiramex and for identifying the issue @andrekeller. Now fixed in v0.11.4.

After October 2024, I plan to end pdfplumber's support of Python 3.8, following the official EOL schedule, but happy to make this quickfix in the meantime.

jsvine avatar Aug 18 '24 23:08 jsvine