TypeError: Couldn't build proto file into descriptor pool!
When objects with the same name are defined in two separate .proto files the above error is thrown only when using the C++ backend for Python
Such name conflict should be reported as an error in every implementation. The pure Python needs to be fixed to report an error as well.
One problem is that in Python there isn't a central DecriptorPool with all generated types so it can't detect such conflicts. Unless such a DescriptorPool is introduced in Python, pure Python implementation won't be able to detect such conflicts. This also applies to Java.
hi all,
any update of this issue? I also met this issue.
Hi feiyuw, if you met this issue, the right solution is to get rid of the duplicated messages (by changing the name of one of them).
hi @xfxyjwf , the proto difinition is included in the to decode file together with protobuf message, and the file format is out of my control, now I use python implementation instead of cpp to work around this problem.
running into this issue too, dropping back to python implementation fixed it.
is the issue really that you can't have objects with the same name in separate .proto files? i have a common practice of defining Request & Response messages in different services and then import them in a common registry.
is the issue just that common registry?
I think using the same name for different message types is not a good practice. In your case, you can set different package names on these .proto files and that will avoid the conflict.
they all have different package names
If they all have different package names, they will not be considered as conflicts. Could you post the content of the .proto files and the exact error message you got?
@xfxyjwf how u solved this problem