Hi all I have a problem with protocol buffers serialised files.
I use python for parsing buffer files. But I can't read any message from 
file, I don't know why.
Writer developed on Java and use CodedInputStream and WriteMassangeNoTag 
for writing buffers file.
I wont to parse this file by python. I have all .proto files compiled 
successful for python. I read PB documentation and find that PB massages 
must be delimited if they are located in one file.

So the questions are next:
1. What is the delimiter CodedInputStream use?
2. Can some one provide code example for python, how to read messages from 
file one by one.

Code Example (Default code from PB Documentation):
JM = proto.myproto_pb2.MyProtoClass()
try:
  f = open(sys.argv[1], "rb")
#  text_format.Merge(f.read(), JM)
#  print(f.read())
  JM.ParseFromString(f.read())
  f.close()
  print (JM)
except IOError:
  print (sys.argv[1] + ": Could not open file.  Creating a new one.")

Return error:
     google.protobuf.message.DecodeError: Tag had invalid wire type.

P.S. If python program write buffer file then python program can read and 
parse it.
So problem happen when java write and python read.

Thanks
Mike.


-- 
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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to