Google Protocol Buffers (protobuf) in Python3 - trouble with ParseFromString (encoding?)

前端 未结 1 579
自闭症患者
自闭症患者 2021-02-08 07:06

I\'ve got Google Protocol buffers 80% working in Python3. My .proto file works, I\'m encoding data, life is almost good. The problem is that I can\'t ParseFromString the result

1条回答
  •  一整个雨季
    2021-02-08 07:54

    ParseFromString is a method -- it does not return anything, but rather fills in self with the parsed content. Use it like:

    message = MyMessageType()
    message.ParseFromString(data)
    print message.some_field
    

    0 讨论(0)
提交回复
热议问题