Skip to content

Write error messages to logger instead of stderr #12882

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
Nov 26, 2018

Conversation

timhoffm
Copy link
Member

PR Summary

@timhoffm timhoffm added this to the v3.1 milestone Nov 24, 2018
@@ -1527,8 +1527,7 @@ def writeXref(self):
borken = False
for offset, generation, name in self.xrefTable:
if offset is None:
print('No offset for object %d (%s)' % (i, name),
file=sys.stderr)
_log.error('No offset for object %d (%s)', i, name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just lift the AssertionError that gets raised a few lines below to this point, instead.

Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

Does this need an API note? Not saying it does, but not sure about our policy regarding changing the format of stderr messages. Otherwise, this looks good to me...

@timhoffm
Copy link
Member Author

This is a rather specific error message. I don't think someone will parse stderr for it. So, I'm fine without an API note.

@jklymak jklymak merged commit 4cab2ec into matplotlib:master Nov 26, 2018
@timhoffm timhoffm deleted the log-instead-of-stderr branch June 10, 2022 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants