Skip to content

Openpyxl typeshed errors #9836

Closed as not planned
Closed as not planned
@tritemio

Description

@tritemio

In an internal project, updating to 3.0.4.7 causes mypy in strict mode to generate the following error:

ocra.py:120: error: Value of type "_WorkbookChild" is not indexable  [index]
ocra.py:124: error: "_WorkbookChild" has no attribute "iter_rows"  [attr-defined]

The code for line 120 is:

...
wb = openpyxl.load_workbook(path)
ws = wb.active
header = [cell.value for cell in ws[1]]  # line 120
...

and for line 124:

ws.iter_rows(min_row=2)  # line 124

The same code checked using 3.0.4.6 passes all mypy checks in strick mode.

It seems like #9764 introduced a regression?

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