Unable to generate GRPC interface for Python?
Do I have to use protobuf with grpc? flatc version 24.3.25 with a simple fbs:
namespace models;
table HelloReply {
message:string;
}
table HelloRequest {
name:string;
}
table ManyHellosRequest {
name:string;
num_greetings:int;
}
rpc_service Greeter {
SayHello(HelloRequest):HelloReply;
SayManyHellos(ManyHellosRequest):HelloReply (streaming: "server");
}
and run flatc -c -p --grpc -o api/ include/fbs/greeter.fbs
output is
error:
Unable to generate GRPC interface for Python
I tried to reproduce this and build tags/v24.3.25.
and your example works fine for me.
$ cat include/fbs/greeter.fbs
namespace models;
table HelloReply {
message:string;
}
table HelloRequest {
name:string;
}
table ManyHellosRequest {
name:string;
num_greetings:int;
}
rpc_service Greeter {
SayHello(HelloRequest):HelloReply;
SayManyHellos(ManyHellosRequest):HelloReply (streaming: "server");
}
$ ../flatc -c -p -o api/ include/fbs/greeter.fbs
$ ls
api include
I tried to reproduce this and build
tags/v24.3.25. and your example works fine for me.$ cat include/fbs/greeter.fbs namespace models; table HelloReply { message:string; } table HelloRequest { name:string; } table ManyHellosRequest { name:string; num_greetings:int; } rpc_service Greeter { SayHello(HelloRequest):HelloReply; SayManyHellos(ManyHellosRequest):HelloReply (streaming: "server"); } $ ../flatc -c -p -o api/ include/fbs/greeter.fbs $ ls api include
This is not with grpc.
Looks like flatbuffer+grpc doesn't support python. I fallback to probobuf.
Ahh you didn't add --grpc in your initial bug report
but yeah with this flag i can reproduce it :+1:
Looks like flatbuffer+grpc doesn't support python.
I don't think that is true we use flatbuffer with grpc at work :sweat_smile:
I think it's just broken in a recent version if it wouldn't be supported the error message is more along the lines of GRPC interface generator not implemented for
@JaydenFish
Hey, thanks for opening this issue. I think there is a known issue with python with directories which can be found here: https://github.com/google/flatbuffers/pull/8074
However following your own example:
Using the following flag flatc -c -p --grpc api/include/fbs/m.fbs. I removed the -o flag since its the cause of the issue to begin with, and the spacing between api/ include.
Thanks!
Sometimes it go wrong. Sometime it works correctly. It's weird.
I have a Makefile about fbs:
%.grpc.fb.h: %.fbs
flatc -c --grpc -o $(dir $*) $^
flatc -p --grpc -o api $^
prename 's/\.cc$//.cpp/' $(dir $*)*.cc
And this is weird. The command specify write output to pyapi and generated, but it generate helloworld_grpc_fb.py in current dir.
I finaly got around to test the new .pyi generation. And I seen similar problems with the generation of the grpc file. (see: https://github.com/google/flatbuffers/pull/8356)
Didn't got around to test with https://github.com/google/flatbuffers/pull/8074 since it would need to be rebased on master which did not look straight forward to me
This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.
not-stale
This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.
@JaydenFish Is this still an issue for you or can this be closed?
As far as i can tell on the latest master the grpc file (greeter_grpc_fb.py) is generated again see:
flatc -c -p --grpc -o api/ include/fbs/greeter.fbs
ls api/models/
greeter_grpc_fb.py HelloReply.py HelloRequest.py __init__.py ManyHellosRequest.py