Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python protobuf base64消息解码错误_Python_Flask_Grpc Python - Fatal编程技术网

Python protobuf base64消息解码错误

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 =

我正在尝试从protobuf base64消息读取数据,该消息来自我的后端

我的字符串是'aaaaaa 8kdqgtebugbcjln62lxs6aaaad2dycgmtc3rhdhvzojancg=='

所以,我创建了下面的原型文件

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)
有人能帮忙解决这个问题吗

提前谢谢