From 4b645ed1b94324dec5e3ee2ddbac71b3ca4c7d16 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 13 Aug 2021 20:43:55 +0100 Subject: [PATCH] Rename rather than copy --- media.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/media.py b/media.py index ed785e88f..c74fd7459 100644 --- a/media.py +++ b/media.py @@ -141,11 +141,13 @@ def _convertImageToLowBandwidth(imageFilename: str) -> None: print('WARN: timed out waiting for low bandwidth image conversion') break if os.path.isfile(lowBandwidthFilename): - copyfile(lowBandwidthFilename, imageFilename) try: - os.remove(lowBandwidthFilename) + os.remove(imageFilename) except BaseException: pass + os.rename(lowBandwidthFilename, imageFilename) + if os.path.isfile(imageFilename): + print('Image converted to low bandwidth ' + imageFilename) else: print('Low bandwidth converted image not found: ' + lowBandwidthFilename)