-
Notifications
You must be signed in to change notification settings - Fork 15.9k
Closed
Labels
Description
I have a package foo
that looks like this:
.
├── data
│ ├── a.proto
│ └── b.proto
└── generated
├── a_pb2.py
├── b_pb2.py
└── __init__.py
# a.proto
package foo;
# b.proto
import "a.proto";
package foo;
Generate the code: protoc -I ./data --python_out=generated data/a.proto data/b.proto
.
Here is the failure:
Python 3.5.1 (default, Mar 3 2016, 09:29:07)
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from generated import b_pb2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/corentih/repro/generated/b_pb2.py", line 16, in <module>
import a_pb2
ImportError: No module named 'a_pb2'
This is beacuse the generated code looks like this:
import a_pb2
If the import was relative it would actually work:
from . import a_pb2
reece, mniak, Slonegg, garrettheel, lromor and 179 morecrwnl3ss and shonfeder