Skip to content

changed warning in animation #11828

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
Aug 10, 2018
Merged
Changes from all commits
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
3 changes: 2 additions & 1 deletion lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,8 @@ class to use, such as 'ffmpeg'. If ``None``, defaults to
extra_args=extra_args,
metadata=metadata)
else:
_log.warning("MovieWriter %s unavailable.", writer)
_log.warning("MovieWriter {} unavailable. Trying to use {} "
"instead.".format(writer, writers.list()[0]))
Copy link
Contributor

@anntzer anntzer Aug 10, 2018

Choose a reason for hiding this comment

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

Please use (a) _log.warning("... %s ...", arg) instead of (b) _log.warning("... {} ...".format(arg)). This is not only a matter of optimization (as the logging docs suggest -- in fact I'd say the cost of the formatting is pretty negligible here), but also because (b) will fail if arg contains a percent sign (because `_log.warning will then try to %-format the string).

Edit: Too bad it looks like there is no pycodestyle check for this(?)


try:
writer = writers[writers.list()[0]](fps, codec, bitrate,
Expand Down