Do not lock downloading file on Windows

Closes #3124
This commit is contained in:
pukkandan 2022-04-05 23:15:17 +05:30
parent 0edb3e336c
commit 8973767198
No known key found for this signature in database
GPG Key ID: 7EEE9E1E817D0A39
1 changed files with 4 additions and 0 deletions

View File

@ -683,6 +683,10 @@ def sanitize_open(filename, open_mode):
for attempt in range(2):
try:
try:
if sys.platform == 'win32':
# FIXME: Windows only has mandatory locking which also locks the file from being read.
# So for now, don't lock the file on windows. Ref: https://github.com/yt-dlp/yt-dlp/issues/3124
raise LockingUnsupportedError()
stream = locked_file(filename, open_mode, block=False).__enter__()
except LockingUnsupportedError:
stream = open(filename, open_mode)