Open morganics opened 1 year ago
Certainly I had the same issue with the original protoc compiler, but generated relative imports are complaining. I have a bunch of protos in the same directory.
I'm using the cmd line to generate the dataclasses:
python -m grpc_tools.protoc -I C:\dir\libroot --python_betterproto_out=src\libs C:\dir\libroot\Protos\myproto.proto
This generates the proto files in the expected location src\libs\packagename\myproto.py, with the following imports, which don't work:
src\libs\packagename\myproto.py
from .packagename import common
However (in my use case) this needs to be:
from . import common
But perhaps I've got the wrong end of the stick!
Thanks.
I also had this problem. Using the latest commit from the master branch of this repository instead of the version on PyPI appears to fix everything.
master
Certainly I had the same issue with the original protoc compiler, but generated relative imports are complaining. I have a bunch of protos in the same directory.
I'm using the cmd line to generate the dataclasses:
python -m grpc_tools.protoc -I C:\dir\libroot --python_betterproto_out=src\libs C:\dir\libroot\Protos\myproto.proto
This generates the proto files in the expected location
src\libs\packagename\myproto.py
, with the following imports, which don't work:from .packagename import common
However (in my use case) this needs to be:
from . import common
But perhaps I've got the wrong end of the stick!
Thanks.