From a383a98af617265803cbfa38f540d5f412899c3c Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Wed, 30 Apr 2014 10:07:32 +0200 Subject: [PATCH] [utils/_windows_write_string] Be defensive about fileno (Fixes #2820) --- youtube_dl/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 2a93d3e34..1036ea9bd 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -926,7 +926,11 @@ def _windows_write_string(s, out): 2: -12, } - fileno = out.fileno() + try: + fileno = out.fileno() + except AttributeError: + # If the output stream doesn't have a fileno, it's virtual + return False if fileno not in WIN_OUTPUT_IDS: return False -- 2.22.2