Having the following structure:
- project1
- project1.py
- protofile_pb2.py
- protofile_pb2_grpc.py
- project2
- project2.py
- protofile_pb2.py
- protofile_pb2_grpc.py
project1.py:
import protofile_pb2.py
...
project2.py:
import protofile_pb2
import project1
...
When running project2.py, I get this error:
TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "protofile.proto":
protofile.proto: A file with this name is already in the pool.
python -m grpc_tools.protoc -I <folder of yourscript.proto> --python_out=<folder of yourscript_pb2.py> --grpc_python_out=<folder of yourscript_grpc_pb2.py> yourscript.proto
– Stefanysteffane