-
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
Python3 import issues #5374
Comments
We are doing experiments on relative imports. |
I guess the most promising methods are 2, 3 and 4 in a helper method, because "../../some.proto" does not seem work with relative imports. |
Method 4 (and 3) would work out of the box with no additional work required |
Any update on this? |
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 language does this apply to?
python (3)
Describe the problem you are trying to solve.
See #1491
Structure
Files
test1.proto
:test2.proto
:test_it.py
:Run
CMD:
protoc "--proto_path=$(pwd)/proto" "--python_out=$(pwd)/src/proto_test/proto"
Run the python file:
Result
ModuleNotFoundError: No module named 'student_pb2'
Describe the solution you'd like
There are 4 proposed solutions that do not prevent parallelism:
https://stackoverflow.com/a/67692
python_package
similar tojava_package
python_package
as a CLI flagAdditionally I think for method 1 and 2 it should be optionally triggered by a commandline flag, like
--python3_relative
Describe alternatives you've considered
You could do:
Which would break other things, if you build for multiple languages (which is a core principle of protobuf)
Additional context
I can create a github repo with an example on request.
The text was updated successfully, but these errors were encountered: