File "/home/eric/dev/myproject/src/adminServer/adminServer_pb2_grpc.py", line 6, in <module>
import adminServer_pb2 as adminServer__pb2
ImportError: No module named 'adminServer_pb2'
from adminServer import adminServer_pb2 as adminServer__pb2
I am new to python and also grpc. So this might be my fault.My grpc tool generates pb2 and pb2_grpc file into "someDir/src/adminServer/" where my working directory is "src".
In this case, my IDE
and python 3.5 command line display error like the following:Error with pb2 file:
File "/home/eric/dev/myproject/src/adminServer/adminServer_pb2_grpc.py", line 6, in <module>
import adminServer_pb2 as adminServer__pb2
ImportError: No module named 'adminServer_pb2'--------------If I change the line 6 into the following, error disappears:
from adminServer import adminServer_pb2 as adminServer__pb2---I guess these errors were raised due to python 3 import rule (these worked with python 2).If there is a way to make grpc tool generate code compatible to python 3, it will be wonderful...Could anyone answer?
Same problem here, the _pb2_grpc.py is generated in a folder of my project toghether with the _pb2.py.The _pb2_grpc.py tries to import the _pb2 from the python path (ie: import generated.interface_pb2 as generated_dot_interface__pb2)
eric@diot:~/src/SPT_DIOT/snooopy/src$ PYTHONPATH=. python3Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linuxType "help", "copyright", "credits" or "license" for more information.>>> from ccodeServer.grpcComm import ccodeMan_pb2>>> from ccodeServer.grpcComm import ccodeMan_pb2_grpcTraceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/eric/src/SPT_DIOT/snooopy/src/ccodeServer/grpcComm/ccodeMan_pb2_grpc.py", line 6, in <module> import ccodeMan_pb2 as ccodeMan__pb2ImportError: No module named 'ccodeMan_pb2'
>>> from ccodeServer.grpcComm import ccodeMan_pb2_grpc
>>>