grpc message字段赋值错误

0

问题描述

今天在写grpc客户端时,对某个message字段赋值,结果报了这个错误

    164                 if args != "organization" and args != "user":
    165                     setattr(update_job, args, kwargs[args])
--> 166             patch_job.job = update_job
    167             request = msg_pb2.LukeRequest(method="PatchJob",user=kwargs["user"],
    168             organization=kwargs["organization"],patch_request=patch_job)

AttributeError: Assignment not allowed to field "job" in protocol message object.

问题分析

问题解答

参考

patch_job.job.CopyFrom(update_job)

解决

你可能感兴趣的

载入中...