Rename rather than copy

main
Bob Mottram 2021-08-13 20:43:55 +01:00
parent 8ce4407473
commit 4b645ed1b9
1 changed files with 4 additions and 2 deletions

View File

@ -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)