diff --git a/cmake/external/protobuf.cmake b/cmake/external/protobuf.cmake index a7ddf193c61f0640fe330e280b4260174772f254..a19400bfda735e4205551c2caaba0e78fafc6ff1 100644 --- a/cmake/external/protobuf.cmake +++ b/cmake/external/protobuf.cmake @@ -130,13 +130,7 @@ function(grpc_protobuf_generate_python SRCS) set(FIL_WE "${FIL_DIR}/${FIL_WE}") endif() endif() - list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py") - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py" - COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --python_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE} - COMMENT "Running Python protocol buffer compiler on ${FIL}" - VERBATIM ) + list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2_grpc.py") add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2_grpc.py" diff --git a/python/paddle_serving_client/__init__.py b/python/paddle_serving_client/__init__.py index 09a91809f52718eb7f52d234b3e8c5406883f419..9e32926732ef1b396473dab2a748f24f63e19e7a 100644 --- a/python/paddle_serving_client/__init__.py +++ b/python/paddle_serving_client/__init__.py @@ -24,6 +24,8 @@ import sys import grpc from .proto import multi_lang_general_model_service_pb2 +sys.path.append( + os.path.join(os.path.abspath(os.path.dirname(__file__)), 'proto')) from .proto import multi_lang_general_model_service_pb2_grpc int_type = 0 diff --git a/python/paddle_serving_server/__init__.py b/python/paddle_serving_server/__init__.py index 3306c040f11dac8834745777d65178624d922bd5..3a5c07011ace961fdfb61ebf3217ab1aab375e82 100644 --- a/python/paddle_serving_server/__init__.py +++ b/python/paddle_serving_server/__init__.py @@ -28,6 +28,9 @@ import fcntl import numpy as np import grpc from .proto import multi_lang_general_model_service_pb2 +import sys +sys.path.append( + os.path.join(os.path.abspath(os.path.dirname(__file__)), 'proto')) from .proto import multi_lang_general_model_service_pb2_grpc from multiprocessing import Pool, Process from concurrent import futures diff --git a/python/paddle_serving_server_gpu/__init__.py b/python/paddle_serving_server_gpu/__init__.py index b26869a2380a3994b18c43c2295c6a40233bfb70..c3c091de0bdfa520c372237a3b79b0c2b1429cd7 100644 --- a/python/paddle_serving_server_gpu/__init__.py +++ b/python/paddle_serving_server_gpu/__init__.py @@ -30,6 +30,9 @@ import fcntl import numpy as np import grpc from .proto import multi_lang_general_model_service_pb2 +import sys +sys.path.append( + os.path.join(os.path.abspath(os.path.dirname(__file__)), 'proto')) from .proto import multi_lang_general_model_service_pb2_grpc from multiprocessing import Pool, Process from concurrent import futures