import subprocess
cmd = "python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. ./kgqa.proto"
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
print(result.stdout)
print(result.stderr)
控制台打印
github.com/gogo/protobuf/gogoproto/gogo.proto: File not found.
google/api/annotations.proto: File not found.
kgqa.proto:6:1: Import "github.com/gogo/protobuf/gogoproto/gogo.proto" was not found or had errors.
kgqa.proto:8:1: Import "google/api/annotations.proto" was not found or had errors.
Process finished with exit code 0