Skip to content Skip to sidebar Skip to footer

When I Try To Generate Files For Protobuf I Get Error Modulenotfounderror

When I try to generate files with the command python -m grpc_tools.protoc -I./ --python_out=. --grpc_python_out=. service.proto I get error. Traceback: test_client.py:11: in <

Solution 1:

There's talk of specifying this at the point of generation in the .proto file in this issue. As far as I know you have two options currently:

1) Change your line 4 to have . in front (this signifies a relative import):

from . import service_pb2 as service__pb2

2) Change the __init__.py file in the "grpc_wrapper" folder to include:

import os
import sys
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))

Post a Comment for "When I Try To Generate Files For Protobuf I Get Error Modulenotfounderror"