Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not work with fsspec's LocalFileOpener #109

Open
toloudis opened this issue Jul 29, 2022 · 0 comments
Open

does not work with fsspec's LocalFileOpener #109

toloudis opened this issue Jul 29, 2022 · 0 comments

Comments

@toloudis
Copy link
Collaborator

toloudis commented Jul 29, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant