diff --git a/python/paddle_serving_client/io/__init__.py b/python/paddle_serving_client/io/__init__.py index 2071e0d1da9e0c12cc431f2d86cfa9d71c79218f..5ffa6262ec9187d649c207bf753f3d051cd48778 100644 --- a/python/paddle_serving_client/io/__init__.py +++ b/python/paddle_serving_client/io/__init__.py @@ -92,9 +92,12 @@ def save_model(server_model_folder, fetch_var.shape.extend(tmp_shape) config.fetch_var.extend([fetch_var]) - cmd = "mkdir -p {}".format(client_config_folder) - - os.system(cmd) + try: + save_dirname = os.path.normpath(client_config_folder) + os.makedirs(save_dirname) + except OSError as e: + if e.errno != errno.EEXIST: + raise with open("{}/serving_client_conf.prototxt".format(client_config_folder), "w") as fout: fout.write(str(config))