From 9d92ac88053a320d48b448542dc2f9dc196d763f Mon Sep 17 00:00:00 2001 From: John Hawkinson Date: Sun, 9 Oct 2016 10:18:52 -0400 Subject: [PATCH] Send traceback to stderr explicitly Per @yan12125, traceback.print_exc() can send output to the wrong place under some circumstances (e.g. use of logger), so send it to stderr. Which requires a compat_str. --- youtube_dl/YoutubeDL.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 166fe8b15..28d0f1e78 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -1701,7 +1701,7 @@ class YoutubeDL(object): self.report_error('unable to download video data: %s' % error_to_compat_str(err)) return except (OSError, IOError) as err: - traceback.print_exc() + self.to_stderr(encode_compat_str(traceback.format_exc())) raise UnavailableVideoError(err) except (ContentTooShortError, ) as err: self.report_error('content too short (expected %s bytes and served %s)' % (err.expected, err.downloaded))