mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-03-10 13:10:09 +01:00
[utils] write_string
: Allow out.mode
to be None
Closes #8816 Authored by: Grub4K
This commit is contained in:
parent
03da517eb5
commit
7045ac8d87
@ -1424,7 +1424,8 @@ def write_string(s, out=None, encoding=None):
|
||||
s = re.sub(r'([\r\n]+)', r' \1', s)
|
||||
|
||||
enc, buffer = None, out
|
||||
if 'b' in getattr(out, 'mode', ''):
|
||||
# `mode` might be `None` (Ref: https://github.com/yt-dlp/yt-dlp/issues/8816)
|
||||
if 'b' in (getattr(out, 'mode', None) or ''):
|
||||
enc = encoding or preferredencoding()
|
||||
elif hasattr(out, 'buffer'):
|
||||
buffer = out.buffer
|
||||
|
Loading…
x
Reference in New Issue
Block a user