I'm trying to invoke protoc within my python script. I am trying to use the grpc.tools.protoc.main() function within my script (the main function takes a list of the command line arguments as input). However, the function call fails when the .proto file is referenced using an absolute or relative path, usually with the error:
You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think)
However, when calling protoc from the command line as a module as "python3 -m grpc_tools.protoc" with the same arguments, it works in the expected way. Any reason this could be happening? I am thinking it has to do with environment variables, but not quite sure.