python-betterproto icon indicating copy to clipboard operation
python-betterproto copied to clipboard

Relative imports

Open morganics opened this issue 2 years ago • 1 comments

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.

morganics avatar Mar 22 '23 12:03 morganics

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.

a-khabarov avatar May 30 '23 10:05 a-khabarov