Skip to content

does not work with fsspec's LocalFileOpener #109

@toloudis

Description

@toloudis

Relatively recent changes to fsspec have caused an incompatibility here. We would like to be able to run code like this:

from aicspylibczi import CziFile
from fsspec.core import url_to_fs

img='path/to/file.czi'
fs, path = url_to_fs(img)
with fs.open(path) as open_resource:
    c = CziFile(open_resource)

The CziFile constructor leads to running this code:

_aicspylibczi.Reader(open_resource)

but the pybind11 code that converts the constructor argument from a BufferedReader to a libCZI IStream does not work with fsspec.implementations.local.LocalFileOpener (which is a subclass of io.IOBase).

There is a workaround, which is to pass open_resource.f to the CziFile constructor

Relevant code:
CziFile.py line 57 and 63
pb_caster_BytesIO.h line 20 and 33

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