Skip to content
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

Importing definitions is not working for Python #235

Open
nilansaha opened this issue Mar 25, 2021 · 1 comment
Open

Importing definitions is not working for Python #235

nilansaha opened this issue Mar 25, 2021 · 1 comment

Comments

@nilansaha
Copy link

nilansaha commented Mar 25, 2021

So, I followed the commands given in the test to try to generate python files for the proto definitions in the all/test/ folder

Here is the command I used which is almost the same as the one used in the test file at all/test.sh

docker run -v `pwd`:/defs namely/protoc-all -f all/test/test.proto -i all/test/ -l python

But when I try to import the generated python file it does not work because apparently the imported definitions are not there or something.

>>> import gen.pb_python.all.test.test_pb2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/nilan/Desktop/docker-protoc/gen/pb_python/all/test/test_pb2.py", line 16, in <module>
    from all.test import include_pb2 as all_dot_test_dot_include__pb2
ImportError: cannot import name 'include_pb2' from 'all.test' (unknown location)

Ideally I am really trying to auto generate python files for proto definitions that could be in different files but are imported in the main file but could not get to do that.

@ido-namely
Copy link
Contributor

Hi @nilansaha,
I'm sorry for the late response.
If this issue is still relevant, would you mind explaining the difference between your invocation and the test?
Perhaps you can also share a proto file definitions to reproduce he issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants