HycJack commited on
Commit
f3358ee
·
1 Parent(s): 74b6126

do not delete tmp file when error

Browse files
Files changed (1) hide show
  1. main.py +5 -5
main.py CHANGED
@@ -94,10 +94,10 @@ async def ocr_table(file: UploadFile = File(...)):
94
  finally:
95
  # ------------------- ⑥ 清理临时文件 -------------------
96
  # 为了防止磁盘被塞满,尽量在请求结束后删除文件
97
- try:
98
- if tmp_path.exists():
99
- tmp_path.unlink()
100
  print(f"已删除临时文件 {tmp_path}")
101
- except Exception as exc:
102
- print(f"删除临时文件 {tmp_path} 失败: {exc}")
103
  return None
 
94
  finally:
95
  # ------------------- ⑥ 清理临时文件 -------------------
96
  # 为了防止磁盘被塞满,尽量在请求结束后删除文件
97
+ # try:
98
+ # if tmp_path.exists():
99
+ # tmp_path.unlink()
100
  print(f"已删除临时文件 {tmp_path}")
101
+ # except Exception as exc:
102
+ # print(f"删除临时文件 {tmp_path} 失败: {exc}")
103
  return None