Hello,

I have a Python project that uses setuptools for deployment. The project 
uses Google Protocol Buffers to define a network message format. My main 
issue is how to make setup.py call the protoc-compiler during installation 
to build the definitions into a _pb2.py file.

Several times I've seen and been given the advice to just distribute the 
resulting _pb2.py files along with the project. While this might work for 
very similar platforms and protobuf versions, I've found several cases 
where this does not work. For example, when I develop on a Mac that uses 
Anaconda Python with protobuf version 2.6.1. and copy the resulting _pb2.py 
along with the rest of the project to a Raspberry Pi running Raspbian with 
protobuf version 2.4.1., there are always import errors coming from the 
_pb2.py modules. However, if I compile the .proto files freshly on the Pi, 
the project works as expected (and can interact with the other side on the 
Mac using the newer versions). So, distributing the compiled files does not 
seem like an option.

For reference: This is the output when using the 2.6.1. generated _pb2.py file 
on the Pi with 2.4.1.

  File "[...]network_manager.py", line 8, in <module>
      import InstrumentControl.transports.serial_bridge_protocol_pb2 as protocol
  File "[...]serial_bridge_protocol_pb2.py", line 9, in <module>
      from google.protobuf import symbol_database as _symbol_database
  ImportError: cannot import name symbol_database

Kind of looking for working and best practice solutions here. It can be 
assumed that the protoc-compiler is installed on the target platform.

Best regards,

Jan

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