]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/postprocessor/embedthumbnail.py
Use `os.replace` where applicable (#793)
[yt-dlp.git] / yt_dlp / postprocessor / embedthumbnail.py
index 7008f4d4dbfb5d155b795df8f956979d9d474b6c..3139a6338824ac9562e1a0f35be0cfc64f2f6cf1 100644 (file)
@@ -222,8 +222,7 @@ def run(self, info):
             raise EmbedThumbnailPPError('Supported filetypes for thumbnail embedding are: mp3, mkv/mka, ogg/opus/flac, m4a/mp4/mov')
 
         if success and temp_filename != filename:
-            os.remove(encodeFilename(filename))
-            os.rename(encodeFilename(temp_filename), encodeFilename(filename))
+            os.replace(temp_filename, filename)
 
         self.try_utime(filename, mtime, mtime)