Skip to content

More helpful error if requested MovieWriter not available #9643

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 1 commit into from
Oct 31, 2017

Conversation

dstansby
Copy link
Member

If the MovieWriterRegistry tries to access a MovieWriter that isn't available, it currently just throws a KeyError.

This change catches that and prints a RuntimeError to let the user know which writer is being accessed, but isn't available.

Discovered by running this in a notebook with an ffmpeg MoveWriter not available:

import matplotlib.pyplot as plt
from matplotlib import animation
from IPython.display import HTML

fig, ax = plt.subplots()

def animate(i): 
    return None

anim = animation.FuncAnimation(fig, animate)
HTML(anim.to_html5_video())

@dstansby dstansby added this to the v2.2 milestone Oct 31, 2017
@tacaswell
Copy link
Member

Can you put a small note in API changes about the change in the raised exception type? Imagine a third-party library that has implemented a 'find me an installed movie writer' function that catches KeyError.

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

modulo an API changes note.

@jklymak jklymak merged commit 3fe12df into matplotlib:master Oct 31, 2017
@dstansby dstansby deleted the animation-error-msg branch October 31, 2017 18:01
@QuLogic QuLogic modified the milestones: needs sorting, v2.2.0 Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants