Python generates grpc in code

import pkg_resources
import sys

from grpc_tools import _protoc_compiler
def main(command_arguments):
    """Run the protocol buffer compiler with the given command-line arguments.

  Args:
    command_arguments: a list of strings representing command line arguments to
        `protoc`.
  """
    command_arguments = [argument.encode() for argument in command_arguments]
    return _protoc_compiler.run_main(command_arguments)


proto_include = pkg_resources.resource_filename('grpc_tools', '_proto')

argv=['', '-I.', '--python_out=.', '--grpc_python_out=.', './helloworld.proto']
main(argv + ['-I{}'.format(proto_include)])

 

150 original articles published · 79 praised · 630,000 views +

Guess you like

Origin blog.csdn.net/liu0808/article/details/103586107