4

I'm a new python programmer. Currently, we are switching from python2 to python3, and we found out all the python script generated by grpc have code like this.

import dataPlatform_pb2 as dataPlatform__pb2

However, python3 do not support this type of relative path import. I need to manually change it to

from . import dataPlatform_pb as dataPlatform__pb2

Is there any better solution for this problem, it seems a bad practice to changing auto generated code all the time.

1 Answer 1

1

I don't think there's anything different that you should be doing at this time. We're working on a fix for the issue but it's likely several weeks from being released. In the meantime I've filed this issue to track adding test coverage representative of your specific use case.

I apologize that we don't have a better answer right now. An easy and practical workaround for the nonce might be to nest your code in a package (directory).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.