Hi all

I'm trying parse protobuf messages subscribed from a zeromq feed using 
Python. Intermittently when I parse the message string, my script crashes 
with the following error

  File "ale-feed-location-reader.py", line 37, in <module>

    aleEvent.ParseFromString(recvMsg)

  File "/usr/lib/python2.7/dist-packages/google/protobuf/message.py", line 
182, in ParseFromString

    self.MergeFromString(serialized)

  File 
"/usr/lib/python2.7/dist-packages/google/protobuf/internal/python_message.py", 
line 798, in MergeFromString

    raise message_mod.DecodeError('Unexpected end-group tag.')

google.protobuf.message.DecodeError: Unexpected end-group tag.

My script looks like the following, seems fairly simple enough. Has anyone 
seen this before, and how would you fix this? My guess is that it is not 
any corruption on the message from the zmq server, as a vendor provided c++ 
compiled program is able to parse the messages without any problem.

----------snip----------
# Socket to talk to server
context = zmq.Context()
clientSock = context.socket(zmq.SUB)
clientSock.connect ("tcp://%s:%s" % (serverAddr, serverPort))
print('Connected to {0} at port {1}'.format(serverAddr, serverPort))

topicfilter = ""
clientSock.setsockopt(zmq.SUBSCRIBE, topicfilter)

while(1):
# Receive Message
recvMsg = ''.join(clientSock.recv_multipart())
# Parse Message
aleEvent = schema_pb2.nb_event()
aleEvent.ParseFromString(recvMsg)
if aleEvent.IsInitialized():
time = datetime.datetime.fromtimestamp(aleEvent.timestamp)
----------snip----------

Thanks for any insight!

-- 
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