grpc_tools没有创建xxx_grpc.py

发布于 2025-01-12 20:41:30 字数 477 浏览 5 评论 0原文

我正在学习 grpc,但遇到了一个问题。

  1. 创建如下所示的 proto 文件(test.proto)
  2. 运行 python3 -m grpc_tools.protoc -I ./protos --python_out=。 ./protos/test.proto

期望有两个文件: test_pb2.pytest_pb2_grpc.py

但只有 test_pb2.py

我不确定我错过了哪一步。

syntax = "proto3";

service PingPongService{
    rpc ping(Ping) returns (Pong){}
}

message Ping{
    int32 count = 1;
}

message Pong{
    int32 count = 2;
}

I am learning grpc, but encounter an issue.

  1. create proto file as showing below (test.proto)
  2. run python3 -m grpc_tools.protoc -I ./protos --python_out=. ./protos/test.proto

expect to have two files:
test_pb2.py and test_pb2_grpc.py

but only have test_pb2.py

I am not sure which step I am missing.

syntax = "proto3";

service PingPongService{
    rpc ping(Ping) returns (Pong){}
}

message Ping{
    int32 count = 1;
}

message Pong{
    int32 count = 2;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

書生途 2025-01-19 20:41:30

看来需要添加以下参数

  --grpc_python_out=.

it seems the following arg needs to be added

  --grpc_python_out=.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文