From a3ffbd93fd735f91d605ecbdeba8e1f4f4baa6ba Mon Sep 17 00:00:00 2001 From: carmichaelong Date: Wed, 1 Oct 2025 14:32:34 -0700 Subject: [PATCH] don't raise if enough attempts were made to rmtree the folder --- mcserver/zipsession_v2.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mcserver/zipsession_v2.py b/mcserver/zipsession_v2.py index 23a00da..4892327 100644 --- a/mcserver/zipsession_v2.py +++ b/mcserver/zipsession_v2.py @@ -336,11 +336,18 @@ def rmtree_with_retry(path, max_retries=5, backoff=0.1): shutil.rmtree(path) return - except (FileNotFoundError, PermissionError, OSError) as e: + except (PermissionError, OSError) as e: if attempt == max_retries - 1: raise time.sleep(backoff * (2**attempt)) + except FileNotFoundError as e: + # In case we've made it here, we've made a best effort to delete + # and it's likely gone. + if attempt == max_retries - 1: + return + time.sleep(backoff * (2**attempt)) + def zipdir_contents_with_retry(dir_path, zip_path, max_retries=5, backoff=0.1): """ Given a source dir_path and a target zip_path, zip the folder with