From 37d8b94de2adb96d26b29bfe4757acfd5029adfd Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Sun, 26 Mar 2023 17:55:06 -0700 Subject: [PATCH] Fix updating repeaterbook cache on windows Apparently windows can't do atomic rename, which means we have to remove and rename (and hope we don't fail in between). Fixes #10479 --- chirp/sources/repeaterbook.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chirp/sources/repeaterbook.py b/chirp/sources/repeaterbook.py index 85652888..dac5d098 100644 --- a/chirp/sources/repeaterbook.py +++ b/chirp/sources/repeaterbook.py @@ -147,7 +147,12 @@ class RepeaterBook(base.NetworkResultRadio): return if results['count']: - os.rename(tmp, data_file) + try: + os.rename(tmp, data_file) + except FileExistsError: + # Windows can't do atomic rename + os.remove(data_file) + os.rename(tmp, data_file) else: os.remove(tmp) status.send_fail('No results!')