Hello. I'm a rookie in protocol buffers and I'm trying to repeat example 
from documentation.

Step 1. Installed protoc
Step 2. Created test.proto file consisted this code:
syntax = "proto3";

message SearchRequest {
  string query = 1;
  int32 page_number = 2;
  int32 results_per_page = 3;
}
Step 3. I ran protoc with help command:
protoc.exe --proto_path=${PWD}/protobuf --python_out=${PWD}/protobuf/ 
${PWD}/protobuf/test.proto

Step 4. I got test_pb2.py file consisted this code:
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: test.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)

_sym_db = _symbol_database.Default()




DESCRIPTOR = 
_descriptor_pool.Default().AddSerializedFile(b'\n\ntest.proto\"M\n\rSearchRequest\x12\r\n\x05query\x18\x01
 
\x01(\t\x12\x13\n\x0bpage_number\x18\x02 
\x01(\x05\x12\x18\n\x10results_per_page\x18\x03 \x01(\x05\x62\x06proto3')

_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'test_pb2', _globals)
if _descriptor._USE_C_DESCRIPTORS == False:

  DESCRIPTOR._options = None
  _globals['_SEARCHREQUEST']._serialized_start=14
  _globals['_SEARCHREQUEST']._serialized_end=91
# @@protoc_insertion_point(module_scope)

But documentation said about other format file for python generated file 
and I have no idea what I need to import in my producer for create message 
object. Generated file didn't contain any classes or something other entity 
for import.

Thanks for any help.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/6bc69beb-9693-4089-abef-f4aa913b023bn%40googlegroups.com.

Reply via email to