Skip to content

Instantly share code, notes, and snippets.

@plantvsbirds
Created August 24, 2017 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plantvsbirds/dbe5c1c12b2430ec1166190e2afdc540 to your computer and use it in GitHub Desktop.
Save plantvsbirds/dbe5c1c12b2430ec1166190e2afdc540 to your computer and use it in GitHub Desktop.
reading protobuf definition from compiled python
import Model_pb2 as M
# model_pb2 could be the compiled source
from google.protobuf.descriptor_pb2 import FileDescriptorProto
f = FileDescriptorProto()
f.MergeFromString(M.DESCRIPTOR.serialized_pb)
print f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment