Rename rather than copy

merge-requests/30/head
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') print('WARN: timed out waiting for low bandwidth image conversion')
break break
if os.path.isfile(lowBandwidthFilename): if os.path.isfile(lowBandwidthFilename):
copyfile(lowBandwidthFilename, imageFilename)
try: try:
os.remove(lowBandwidthFilename) os.remove(imageFilename)
except BaseException: except BaseException:
pass pass
os.rename(lowBandwidthFilename, imageFilename)
if os.path.isfile(imageFilename):
print('Image converted to low bandwidth ' + imageFilename)
else: else:
print('Low bandwidth converted image not found: ' + print('Low bandwidth converted image not found: ' +
lowBandwidthFilename) lowBandwidthFilename)