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

Conversation

fredrik-1
Copy link
Contributor

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.

@@ -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 {} \
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

Copy link
Member

@dstansby dstansby left a 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

@tacaswell tacaswell added this to the v3.0 milestone Aug 9, 2018
@@ -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 {} \
Copy link
Member

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 \

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.

Minor style quibble, but not one we enforce via CI so will not hold PR over it.

@fredrik-1
Copy link
Contributor Author

Changed.

@dopplershift dopplershift merged commit b44aeca into matplotlib:master Aug 10, 2018
@@ -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(?)

@fredrik-1 fredrik-1 deleted the animation_warning branch August 19, 2018 13:58
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.

5 participants