File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ if(WITH_PYTHON)
157
157
#Generate an empty \
158
158
#__init__.py to make framework_py_proto as a valid python module.
159
159
add_custom_target (framework_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch __init__.py )
160
- add_dependencies (framework_py_proto framework_py_proto_init )
160
+ add_dependencies (framework_py_proto framework_py_proto_init trainer_py_proto )
161
161
if (NOT WIN32 )
162
162
add_custom_command (TARGET framework_py_proto POST_BUILD
163
163
COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_BINARY_DIR} /python/paddle/fluid/proto
Original file line number Diff line number Diff line change @@ -33,15 +33,11 @@ def __init__(self):
33
33
# Workaround for relative import in protobuf under python3
34
34
# TODO: should be fixed
35
35
cur_path = os .path .dirname (__file__ )
36
- sys .path .append (cur_path )
37
- sys .path .append (cur_path + "/proto" )
38
-
39
- # Just for fix random UT fail, will be deleted soon
40
- print ("cur_path: " , cur_path )
41
- print ("sys.path: " , sys .path )
42
- if os .path .isdir (cur_path + "/proto" ):
43
- print ("[listdir]" )
44
- print (os .listdir (cur_path + "/proto" ))
36
+ if cur_path not in sys .path :
37
+ sys .path .append (cur_path )
38
+ if cur_path + "/proto" not in sys .path :
39
+ sys .path .append (cur_path + "/proto" )
40
+
45
41
from proto import trainer_desc_pb2
46
42
self .proto_desc = trainer_desc_pb2 .TrainerDesc ()
47
43
import multiprocessing as mp
You can’t perform that action at this time.
0 commit comments