It's my mistake. I forgot to open file as 'Binary' mode.
fds.ParseFromString(open('foo.desc', 'rb').read()) This solved the problem cleary. Sorry.. On 3월2일, 오전10시28분, haje01 <haj...@gmail.com> wrote: > I am using protobuf v2.4.0 in Windows and having problems. > > Say I have following message file. 'foo.proto' > > message School > { > optional int32 students = 1; > } > > from which I generated description set file 'foo.desc' like this: > > protoc -o foo.desc foo.proto > > and, reading description set file.. > > from google.protobuf.descriptor_pb2 import FileDescriptorSet > > fds = FileDescriptorSet() > fds.ParseFromString(open('foo.desc').read()) > > generates following error message: > > File "build\bdist.win32\egg\google\protobuf\message.py", line 179, > in ParseFromString > File "build\bdist.win32\egg\google\protobuf\internal > \python_message.py", line 755, in MergeFromString > File "build\bdist.win32\egg\google\protobuf\internal > \python_message.py", line 782, in InternalParse > File "build\bdist.win32\egg\google\protobuf\internal\decoder.py", > line 521, in DecodeRepeatedField > google.protobuf.message.DecodeError: Truncated message. > > Strangely enough, when I changed field name from 'students' to > 'student', no error occurred. > > Any ideas? -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.