Skip to content

Animation error handling (Fixes #6416) #6441

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

Merged
merged 4 commits into from
May 17, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
MNT: Improve error message when saving animation fails.
  • Loading branch information
dopplershift committed May 17, 2016
commit ecfc1e724173e2ac7bb8e3d1fe9a368e976b3df5
6 changes: 4 additions & 2 deletions lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,14 @@ def grab_frame(self, **savefig_kwargs):
# frame format and dpi.
self.fig.savefig(self._frame_sink(), format=self.frame_format,
dpi=self.dpi, **savefig_kwargs)
except RuntimeError:
except (RuntimeError, IOError):
out, err = self._proc.communicate()
verbose.report('MovieWriter -- Error '
'running proc:\n%s\n%s' % (out,
err), level='helpful')
raise
raise IOError('Error saving animation to file. '
'Stdout: {0} StdError: {1}. It may help to re-run '
'with --verbose-debug.'.format(out, err))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original exception is now getting swallowed. Would probably be nice to at least have it logged through verbose.report()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's even better to just include it in the new exception message.


def _frame_sink(self):
'Returns the place to which frames should be written.'
Expand Down