From 9af61ada3a8869c9dd66290d3f16d0fb87ed95e7 Mon Sep 17 00:00:00 2001 From: xaoyaoo Date: Mon, 22 Apr 2024 22:34:51 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=97=A0=E6=B3=95auto=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pywxdump/api/api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pywxdump/api/api.py b/pywxdump/api/api.py index 15854a5..8f055d5 100644 --- a/pywxdump/api/api.py +++ b/pywxdump/api/api.py @@ -76,8 +76,12 @@ def init_key(): return ReJson(1002, body=f"my_wxid is required: {my_wxid}") out_path = os.path.join(g.tmp_path, "decrypted", my_wxid) if my_wxid else os.path.join(g.tmp_path, "decrypted") + # 检查文件夹中文件是否被占用 if os.path.exists(out_path): - shutil.rmtree(out_path) + try: + shutil.rmtree(out_path) + except PermissionError as e: + return ReJson(2001, body=str(e)) code, merge_save_path = decrypt_merge(wx_path=wx_path, key=key, outpath=out_path) time.sleep(1)