If you are using proto3, HasField is not supported for primitive types.

On Wed, Apr 20, 2016 at 4:13 AM, Robert Kuska <rku...@gmail.com> wrote:

> Consider following code:
>
> message Fly{
>  uint32 dtime = 1;
> }
>
> >>> d.ListFields()[0][0].name
> 'dtime'
> >>> d.ListFields()[0][0].full_name
> 'Fly.dtime
> >>>
> >>> d.HasField('dtime')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File
> "/home/rkuska/.local/lib/python2.7/site-packages/google/protobuf/internal/python_message.py",
> line 825, in HasField
>     raise ValueError(error_msg % field_name)
> ValueError: Protocol message has no non-repeated submessage field
> "dtime_utc"
> >>> d.HasField('Fly.dtime')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File
> "/home/rkuska/.local/lib/python2.7/site-packages/google/protobuf/internal/python_message.py",
> line 825, in HasField
>     raise ValueError(error_msg % field_name)
> ValueError: Protocol message has no non-repeated submessage field
> "Flight.dtime_utc"
>
> What does HasField expect as a parameter?
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to