如何解决必须以<proto name>实例作为第一个参数来调用未绑定方法ListFields
我有一些Python protobuf代码,试图遍历消息类型的字段。但是我遇到了一个奇怪的错误。在pdb中隔离:
(Pdb) message
<class 'test_platform.request_pb2.Test'>
(Pdb) type(message)
<class 'google.protobuf.internal.python_message.GeneratedProtocolMessageType'>
(Pdb) message.ListFields()
*** TypeError: unbound method ListFields() must be called with Test instance as first argument (got nothing instead)
我很困惑。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。