Readding struct with random access. Message contains non-struct pointer error.

Skip to first unread message


Nov 1, 2022, 4:46:41 PM11/1/22
to Cap'n Proto
Hi. Now I trying to write a large struct ( 2GB aprox. ) and then read only an attribute of it.  I write it doing something like:

object_capnp.Object(all_the_data).write( open(file, "w+b") )

Then, when the struct is on the file, I am trying to read it:

If I read it doing object_capnp.Object().read(file)  all the file is loaded on memory.

If I read it using the random access i do:

message = capnp._StreamFdMessageReader(file)
object = message.get_root( object_capnp.Object )

But then the next error is raised:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "capnp/lib/capnp.pyx", line 3746, in capnp.lib.capnp._MessageReader.get_root
capnp.lib.capnp.KjException: capnp/layout.c++:2165: failed: expected ref->kind() == WirePointer::STRUCT; Message contains non-struct pointer where struct pointer was expected.

Whats the problem with that?  I'm reading these docs:

Thanks for the help.

Reply all
Reply to author
0 new messages