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

Update api.py

Browse files
Files changed (1) hide show
  1. api.py +2 -1
api.py CHANGED
@@ -59,7 +59,8 @@ async def delete_files(directory: str):
59
  def file_executer(file_name:str)->"执行返回":
60
  try:
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)
 
59
  def file_executer(file_name:str)->"执行返回":
60
  try:
61
  print("开始执行py任务",file_name)
62
+ # result = subprocess.check_output(["python", f"{file_name}.py"]).decode("utf-8")
63
+ result = subprocess.check_output(["python", f"{file_name}.py"], stderr=subprocess.STDOUT).decode("utf-8")#显示运行中的print
64
  print("执行完成py任务:",file_name,"结果如下")
65
  print(result)
66
  return PlainTextResponse(result)