-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print traceback when raising UnavailableVideoError #10888
Print traceback when raising UnavailableVideoError #10888
Conversation
An OSError or IOError generally indicates something a little more wrong than a "simple" UnavailableVideoError, so print the actual traceback that leads to the exception. Otherwise meaningful postmortem debugging a bug report is essentially infeasible.
Exception handling in youtube-dl is quite messy... The best way to fix this is exploiting Python 3's exception chaining. [1] python-future [2] provides A possible short term fix is introducing the Anyway the traceback should NOT be printed to stderr directly. Use [1] https://www.python.org/dev/peps/pep-3134/ |
This reverts commit ca14b60. Moved to PR #10888.
All of the |
In CLI they did print to stderr, while applications that use the Python API may intercept them using |
Huh? It's clear they go to stderr in youtube-dl. Are you saying you still want me to do
? |
Only when
Yes, just without the first underscore (_self => self) |
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.
OK, thanks, done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically this looks good. As it's not a clean solution, I'd like to wait for a few days to see whether there's objection or not.
Hmm the first exception is not shown with this patch. Anything wrong?
|
Err, it works for me. Did you mean to run it out of the build tree instead of the
instead of
? I get:
Ah yes, your run was:
|
I apply this patch with a commit, so the commit ID does not change. Let me check it out more. |
Looks like a python3 issue. You confused me when you wrote:
But python3 shows the inner traceback but not the outer one, but I think that's the more useful one to show. So it looks like this patch is only relevant for python2. Still worth doing though. |
Hello! what is needed to get this and #10876 merged? |
An OSError or IOError generally indicates something a little more
wrong than a "simple" UnavailableVideoError, so print the actual
traceback that leads to the exception. Otherwise meaningful postmortem
debugging from a bug report is essentially infeasible.
Forked this pull request from #10876 (Fix UnavailableVideoError when writing to pipes) as requested by @yan12125.