Don't you want mode "wb"? Sounds like a classic case of opening a file in
text mode and getting LF -> CRLF translation happening on Windows.
On 11 December 2013 06:04, Andrew Beck <abec...@gmail.com> wrote:
> Using python 2.7.6 on darwin and windows, both using protoc 2.5.0 and libs
> from 2.5.0, the python code on windows (see test.py in the attached zip)
> contains two extra bytes valued 0x0D in the message compared to the darwin
> version. These extra bytes are preventing c++ libprotobuf from parsing the
> file. Just to be sure it wasn't some null termination causing the parse to
> fail, I'm using ParsePartialFromArray in the exe.
> The same code run on darwin using the same version of python (CPython
> 2.7.6) and protobufs (2.5.0) generates the correct code and can be parsed
> with the windows and python c++ code. It appears only the python code on
> windows is producing incompatible messages.
> Attached is minimal code and setup for reproducing the problem:
> Entity.proto (protobuf def)
> main.cpp (c++ parsing code)
> test.py (python code generating protobuf message)
> test_Darwin.pb (the output from the python file on darwin)
> test_Windows.pb (the output from the python file on windows)
> wscript (simple waf script for building these files)
> Any help would be greatly appreciated since this is a major issue for my
> 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 firstname.lastname@example.org.
> Visit this group at http://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/groups/opt_out.
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 post to this group, send email to email@example.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.