You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have several message .pb files which i compile into python3 code. They all follow a package structure, "package myprotos.suba". There are several .pb files and corresponding modules, subBase, suba, subb. suba and subb import subBase. I now want to put all those generated python modules into one python package "myprotos". so i create "myprotos" directory, and add an empty init.py file.
Then in python code i should be able to do the following:
importmyprotosfrommyprotosimportsuba# fails because suba is not in the path
However, this fails in the auto-generated module suba at the following statement:
importsubBase
This is because python3 drops the support for these relative imports. A correctly generated code would look something like this:
importmyprotosfrommyprotosimportsubBase
Because the proto files already specifies package and subpackages it would be possible to generate an entire output directory with as a python package with working, cross-referencing imports.
The text was updated successfully, but these errors were encountered:
This issue only concerns python3 generated code.
I have several message .pb files which i compile into python3 code. They all follow a package structure, "package myprotos.suba". There are several .pb files and corresponding modules, subBase, suba, subb. suba and subb import subBase. I now want to put all those generated python modules into one python package "myprotos". so i create "myprotos" directory, and add an empty init.py file.
Then in python code i should be able to do the following:
However, this fails in the auto-generated module suba at the following statement:
This is because python3 drops the support for these relative imports. A correctly generated code would look something like this:
Because the proto files already specifies package and subpackages it would be possible to generate an entire output directory with as a python package with working, cross-referencing imports.
The text was updated successfully, but these errors were encountered: