-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
changed warning in animation #11828
Conversation
lib/matplotlib/animation.py
Outdated
@@ -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. Using {} \ |
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.
Can this be "Trying to use" instead, because the following code block can still raise an error.
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.
Changed.
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.
👍 with a small change
fabf887
to
eb96a21
Compare
lib/matplotlib/animation.py
Outdated
@@ -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 {} \ |
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.
Our standard style is to use
some_function("text"
"text")
rather than \
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.
Minor style quibble, but not one we enforce via CI so will not hold PR over it.
eb96a21
to
1e00655
Compare
Changed. |
@@ -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])) |
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 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(?)
From #11792.
The warning message when the writer chosen is not available didn't say that another writer is used instead. That can be confusing and it is changed in this pr.