我试图了解protobuf和python如何协同工作,但我不明白为什么会收到错误消息:
google.protobuf.message.DecodeError:解析消息时出错
这是.proto文件:
message PMCounterValuesReport
{
required uint32 id = 1;
required bytes uri = 2;
repeated int64 values = 3 [packed=true];
repeated uint32 average_weights = 4 [packed=true];
required bytes updated_counters = 5;
}
required uint64 timestamp = 1;
required bool last = 2;
repeated Object objects = 3;
}
这是我要解析的字符串:38370000 00171110 6A171110 0C00C200 08ECADE8 E0F90410 011A1F08 EAAE1812 1401000F 0002027C F0250001 26000127 00012A00 012A0100 1A001A20 08EAAE14 12140100 0F000202 7CF02500 01260001 27000128 00012A02 00001A00 1A2308EA 2E121401 000F0002 027CF025 00012600 01310001 3200012A 06000000 0000001A 001A2008 EAAE1412 1401000F 0002027C F0250001 26000127 00012800 022A0200 001A001A 1D08EAAE 0C121101 000F0002 027CF025 00012600 01310001 2A020000 1A00
这应该是一条消息。
到达msg.ParseFromString(string)
时出现错误。
这是否意味着.proto文件错误或字符串?