-
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
[v3.0.0-beta] Python 3 can't import properly related proto files #762
Labels
Comments
Looks similar to #881, I think have a workaround/possible solution for the issue there |
Actually I used another trick to solve this issue. I run 2to3 on src_gen folder after every invoke to protoc and everything works properly both on Python 2.7 and 3 But it is what it is - a workaround. |
I think this is a duplicate of #1491 |
adellahlou
pushed a commit
to adellahlou/protobuf
that referenced
this issue
Apr 20, 2023
… comments for the next declaration, see protocolbuffers#762
rinarakaki
pushed a commit
to rinarakaki/protobuf
that referenced
this issue
Aug 30, 2023
PiperOrigin-RevId: 473026273
bithium
pushed a commit
to bithium/protobuf
that referenced
this issue
Sep 4, 2023
PiperOrigin-RevId: 473026273
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello!
I have two proto files core.proto and items.proto, items.proto import core.proto. They are generated into project's subdirectory src_gen. Problem is that in generated Python code there is import in items_pb2.py:
It doesn't work in Python 3 since it's relative import and syntax for relative import changed in Python 3. It should be (at the begining for python 2.5+ compatibility):
And replace import:
This is how I feel it should solved but I might be unaware of some other method. Is there any other solution?
The text was updated successfully, but these errors were encountered: