Python protobuf base64消息解码错误
我正在尝试从protobuf base64消息读取数据,该消息来自我的后端 我的字符串是'aaaaaa 8kdqgtebugbcjln62lxs6aaaad2dycgmtc3rhdhvzojancg==' 所以,我创建了下面的原型文件Python protobuf base64消息解码错误,python,flask,grpc-python,Python,Flask,Grpc Python,我正在尝试从protobuf base64消息读取数据,该消息来自我的后端 我的字符串是'aaaaaa 8kdqgtebugbcjln62lxs6aaaad2dycgmtc3rhdhvzojancg==' 所以,我创建了下面的原型文件 syntax = "proto2"; //protoc -I=. --python_out=. ./message.proto message ArtifactList { repeated Artifact artifacts =
syntax = "proto2";
//protoc -I=. --python_out=. ./message.proto
message ArtifactList {
repeated Artifact artifacts = 1;
required bool grpcStatus = 2;
}
message Artifact {
required string id = 1;
required string type_id = 2;
required string uri = 3;
}
在生成python原型文件之后,我将使用如下方法
import message_pb2
import base64
base64_message = 'AAAAAA8KDQgTEBUgBCjln62lxS6AAAAAD2dycGMtc3RhdHVzOjANCg=='
message_bytes = base64.b64decode(base64_message)
artifactList = message_pb2.ArtifactList()
artifactList.ParseFromString(message_bytes)
print(artifactList)
print(message_bytes)
当我运行此程序时,我的错误率低于。我不知道为什么会发生这个错误
RuntimeWarning: Unexpected end-group tag: Not all data was converted
artifactList.ParseFromString(message_bytes)
有人能帮忙解决这个问题吗
提前谢谢