Closed fungs closed 5 months ago
I'm closing this myself. The real issue is, that the documentation doesn't specify any behavior or return type when the file ends (when it hits EOF). This confused my back then.
This is the crude way pycapnp determines internally the end of a file stream.
except capnp.KjException as e:
if 'EOF' in str(e):
Hi,
this is probably more of a clarification request. I know that pycapnp wraps all the C++ code, but in case this is a bug, I wanted to have this referenced here first. It might also help other users since the documentation is scarce at the moment.
Simple case: I'm reading a sequence of serialized objects from a file stream (a fifo in my case). On the sender side, these are just produced using
filestream_object_async.write(capnp_object.to_bytes())
(using async io) orcapnp_object.write(filestream_object_sync)
(using sync io). When I read the stream, I can do this either usingcapnp_object_type.read_multiple(filestream_object_sync)
with iterator syntaxcapnp_object_type.read(filestream_object_sync)
multiple timesThis seems to work equivalently except the last item sent. Using
read()
, this produces a parsing error:It this intended behavior?