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

Ability for codc to read an ODB file from memory #21

Open
TomHodson opened this issue Mar 15, 2024 · 0 comments
Open

Ability for codc to read an ODB file from memory #21

TomHodson opened this issue Mar 15, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@TomHodson
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

In order to read an ODB from memory, with pyodc you can do something like:

import pyodc, codc
from io import BytesIO

fake_file = BytesIO(b".... raw ODB content ....")
df = pyodc.read_odb(fake_file)

The same trick doesn't work with codc because it expects the input to have the interface of a file on disk, it throws this error:

File ~/git/pyodc/codc/reader.py:21, in Reader.__init__(self, source, aggregated, max_aggregated)
     19 reader = ffi.new("odc_reader_t**")
     20 if isinstance(source, io.IOBase):
---> 21     lib.odc_open_file_descriptor(reader, source.fileno())
     22 else:
     23     assert isinstance(source, str)

UnsupportedOperation: fileno

It would be nice, though perhaps difficult, to modify to C-C++ interface layer to accept a point to a buffer to read from.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Organisation

No response

@TomHodson TomHodson added the enhancement New feature or request label Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant