summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-04-30 10:07:32 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-04-30 10:07:32 +0200
commita383a98af617265803cbfa38f540d5f412899c3c (patch)
tree5cc31f27c4300f8498c1feeea79ae6759121369a
parentacd69589a54d03f60a018a298c74a4c8aef2abc2 (diff)
downloadyoutube-dl-a383a98af617265803cbfa38f540d5f412899c3c.tar.gz
youtube-dl-a383a98af617265803cbfa38f540d5f412899c3c.tar.xz
youtube-dl-a383a98af617265803cbfa38f540d5f412899c3c.zip
[utils/_windows_write_string] Be defensive about fileno (Fixes #2820)
-rw-r--r--youtube_dl/utils.py6
1 files changed, 5 insertions, 1 deletions
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