-
Notifications
You must be signed in to change notification settings - Fork 15.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Couldn't build proto file into descriptor pool: duplicate symbol 'MyRequest' #18463
Comments
I have also unsuccessfully tried:
which results in the similar error:
|
This is working as expected - both of the proto files you're importing attempt to define the same messages, which is an error. Typically when evolving schema, changes are done in place so that you can continue serving clients that have the old schema and may not be aware of the latest changes. Consider the following as the only proto you script imports:
Legacy clients will continue populating the original If you absolutely have to have completely separate schema for each version, than you'll need avoid the name collisions by either changing the message name in one of the proto files, or separating them into distinct directories so that they have different package prefixes. See https://protobuf.dev/reference/python/python-generated/#package for more details. |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment. This issue is labeled |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it. This issue was closed and archived because there has been no new activity in the 14 days since the |
What version of protobuf and what language are you using?
protoc 28.1
python 3.12.6
What operating system (Linux, Windows, ...) and version?
macOS 14.6.1
What runtime / compiler are you using (e.g., python version or gcc version)
I am not sure, sorry. I just use the protoc and python from the homebrew
What did you do?
MyProtoV1.proto:
MyProtoV2.proto:
my_proto.py:
Commands I run:
What did you expect to see
The script whould print request1 and request2 objects
What did you see instead?
Anything else we should know about your project / environment
I was expecting being able using both versions of MyProtoV1.proto and MyProtoV2.proto in the same script (to support different clients in my server).
Thank you!
The text was updated successfully, but these errors were encountered: