Skip to content

Not enough information in the exception raised by read_excel if the file is locked #413

@clo-vis

Description

@clo-vis

When trying to read an excel file that is locked, an exception is raised, but there is no information in the exception that tells you why the file could not be opened:

# tested on Windows
from msvcrt import LK_RLCK, locking
from pathlib import Path

from fastexcel import read_excel

file = Path("file.xlsx")

with file.open("rb") as f:
    locking(f.fileno(), LK_RLCK, file.stat().st_size)
    read_excel("file.xlsx")

Error message:

_fastexcel.CalamineError: calamine error: Xlsx error: Zip error: i/o error
Context:
    0: Could not open workbook at file.xlsx
    1: could not load excel file at file.xlsx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions