-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Improved exception handling on animation failure #12369
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
Conversation
d7a7107
to
ba0bfe3
Compare
So will this need a rebase once #12368 is in? A lot of the changes look the same. Otherwise, in principle I'm 👍 on the change. The exception change seems worth it to me. |
ba0bfe3
to
238a50e
Compare
the first commit was shared, rebased this pr now that the other is merged. |
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.
Please rebase, since #12366 is in and should fix the CI errors.
238a50e
to
d1f2178
Compare
done |
Previously, if an animation-generating subprocess (e.g. ffmpeg) failed while data was piped in, we'd get a ValueError because we'd communicate() with the subprocess once in grab_frame(), to generate a first error, and again at cleanup time, in the finally: clause, but that second time, the subprocess' stdout and stderr had already been closed. Instead, don't do anything in grab_frame() and let the finally: clause handle the errors. Also replace the nondescript RuntimeError by a CalledProcessError, which is more descriptive, generates a proper error message by itself ("Command 'foo' returned non-zero exit status 42") and is more easily introspectable (it includes stdout, stderr as attributes). Given that we would previously sometimes throw a ValueError instead of the intended RuntimeError, I think the API change is worth it. Un-xfail a test.
d1f2178
to
258c53b
Compare
ping @dopplershift for a review when you have time.... |
PR Summary
Previously, if an animation-generating subprocess (e.g. ffmpeg)
failed while data was piped in, we'd get a ValueError because we'd
communicate() with the subprocess once in grab_frame(), to generate a
first error, and again at cleanup time, in the finally: clause, but that
second time, the subprocess' stdout and stderr had already been closed.
Instead, don't do anything in grab_frame() and let the finally: clause
handle the errors.
Also replace the nondescript RuntimeError by a CalledProcessError, which
is more descriptive, generates a proper error message by itself
("Command 'foo' returned non-zero exit status 42") and is more easily
introspectable (it includes stdout, stderr as attributes). Given that
we would previously sometimes throw a ValueError instead of the intended
RuntimeError, I think the API change is worth it.
Un-xfail a test.
Builds on top of #12368. Closes the second half of #9205.
PR Checklist