Give a better error message on missing PostScript fonts #6428
Merged
tacaswell merged 2 commits intomatplotlib:masterfrom Dec 19, 2016
Merged
Give a better error message on missing PostScript fonts #6428tacaswell merged 2 commits intomatplotlib:masterfrom
tacaswell merged 2 commits intomatplotlib:masterfrom
Conversation
Member
|
Cycled to retrigger appveyor I think the error is unrelated. |
Member
|
👍 looks good to me |
Member
Author
|
The appveyor error does seem unrelated: |
Member
Author
|
trying to retrigger appveyor |
| bbox_inches_restore=_bbox_inches_restore) | ||
| self.figure.draw(renderer) | ||
| renderer.finalize() | ||
| file.finalize() |
Member
Author
There was a problem hiding this comment.
The file.close() call in the finally section no longer does the finalization. The finalization is the part that cannot be reasonably done if something has raised an exception (in this case, the missing font) so it belongs in the try section.
If an error is raised and the object state is inconsistent,
we shouldn't try to finalize the file, just close all resources.
The idea is to support the following idiom:
try:
figure.draw(file) # write pdf file, can raise
file.finalize() # do this if everything went well
finally:
file.close() # do this in any case
For matplotlib#4167; does not fix the problem, as it would need supporting a whole different kind of font, but gives a more useful error message.
c820a5d to
4fcc0e7
Compare
Member
Author
|
Rebased in the hope that the AppVeyor change in master makes the tests more robust. |
Member
|
LGTM 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #4167; does not fix the problem, as it would need supporting a whole different kind of font, but gives a more useful error message.