rogerxavier commited on
Commit
49f01e6
1 Parent(s): bc7dec9

Update api.py

Browse files
Files changed (1) hide show
  1. api.py +2 -2
api.py CHANGED
@@ -61,11 +61,11 @@ def file_executer(file_name:str)->"执行返回":
61
  print("开始执行py任务",file_name)
62
  result = subprocess.check_output(["python", f"{file_name}.py"]).decode("utf-8")
63
  print("执行完成py任务:",file_name,"结果如下")
64
- print(PlainTextResponse(result))
65
  return PlainTextResponse(result)
66
  except subprocess.CalledProcessError as e:
67
  print("执行py任务失败",file_name,"原因如下")
68
- print(PlainTextResponse(f"Error executing {file_name}.py: {e}"))
69
  return PlainTextResponse(f"Error executing {file_name}.py: {e}")
70
 
71
  @app.get("/execute_py_file/{file_name}")
 
61
  print("开始执行py任务",file_name)
62
  result = subprocess.check_output(["python", f"{file_name}.py"]).decode("utf-8")
63
  print("执行完成py任务:",file_name,"结果如下")
64
+ print(result)
65
  return PlainTextResponse(result)
66
  except subprocess.CalledProcessError as e:
67
  print("执行py任务失败",file_name,"原因如下")
68
+ print(f"Error executing {file_name}.py: {e}")
69
  return PlainTextResponse(f"Error executing {file_name}.py: {e}")
70
 
71
  @app.get("/execute_py_file/{file_name}")