0

我正在尝试阅读 captian proto .bin 消息(以打包形式编写):

dag_file = dag_api_capnp.Dag.read_packed(dependency_file, traversal_limit_in_words=2 ** 64 - 1)

但它会产生以下错误:

Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_exec2.py", line 1, in Exec
    def Exec(exp, global_vars, local_vars=None):
  File "<input>", line 1, in <module>
  File "capnp/lib/capnp.pyx", line 3013, in capnp.lib.capnp._StructModule.read_packed
  File "capnp/lib/capnp.pyx", line 3600, in capnp.lib.capnp._PackedFdMessageReader.__init__
capnp.lib.capnp.KjException: kj/io.c++:53: failed: expected n >= minBytes; Premature EOF
stack: 122b411e3 122b43536 122a48a97 108ca7d40 1229aa340 122a5a3d7 108c0fcf0 108c15396 108d64cf4 108d62abe 10a9f7f4c 108d5520a 108d4f728 108c6ef33 108d64cf4 108d62a04 10a9f7f4c 108d5520a 108c1117d 108d64cf4 108d62a04 10a9f7f4c 108c110c1 108d64cf4 108d616f9 10a9f7f4c 108c110c1 108d64cf4 108d61662 10a9f7f4c 108c110c1

为什么会出现这个错误?我假设我没有正确阅读打包的消息(或类似的东西)。如何在 Captain proto for python 中正确打开这个文件的内容?

我阅读了以下链接,但它们没有帮助:

  1. 部分读取/写入 Cap'n Proto 消息
  2. 如何设置 Cap'n Proto RPC 消息遍历限制?
  3. https://github.com/capnproto/capnproto/issues/545
  4. https://jparyani.github.io/pycapnp/capnp.html#capnp._StructModule.read_packed

但他们并没有太大帮助。似乎很难在网上找到任何带有确切错误消息的东西:expected n >= minBytes; Premature EOF除了链接 4 似乎不太有用(并且没有提到 python 一词)。

顺便说一句,所有这三个都给出错误:

                dag_file = dag_api_capnp.Dag.read_packed(dependency_file, traversal_limit_in_words=2 ** 64 - 1)
                dag_file = dag_api_capnp.Dag.read_packed(dependency_file)
                dag_file = dag_api_capnp.Dag.read(dependency_file)

交叉发布:https ://github.com/capnproto/pycapnp/issues/257

4

0 回答 0