Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FIX: Catch IOError on font-cache write#9676

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
anntzer merged 1 commit intomatplotlib:masterfromjklymak:font_cache
Nov 4, 2017

Conversation

jklymak
Copy link
Member

@jklymakjklymak commentedNov 3, 2017
edited
Loading

Fails gracefully if font-manager cache cannot be written.

Fixes#9548

PR Summary

PR Checklist

  • Code is PEP 8 compliant

@jklymakjklymak added this to thev2.1.1 milestoneNov 3, 2017
Do not error on font-cache write error
@tacaswell
Copy link
Member

It is not worth finding a way to force this exception to test it.

@anntzer
Copy link
Contributor

lgtm

@anntzeranntzer merged commit0084e4a intomatplotlib:masterNov 4, 2017
dstansby added a commit that referenced this pull requestNov 4, 2017
try:
json.dump(data, fh, cls=JSONEncoder, indent=2)
except IOError as e:
warnings.warn('Could not save font_manager cache ', e)
Copy link

Choose a reason for hiding this comment

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

Guys, this use of warnings.warn does not seem to match the API specification:

https://docs.python.org/2/library/warnings.html#warnings.warn

I was just hit by this problem:

Traceback (most recent call last):File "/my/python/file.py", line 15, in <module>    from matplotlib import pyplot as pltFile "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 31, in <module>    import matplotlib.colorbarFile "/usr/lib64/python2.7/site-packages/matplotlib/colorbar.py", line 36, in <module>    import matplotlib.contour as contourFile "/usr/lib64/python2.7/site-packages/matplotlib/contour.py", line 20, in <module>    import matplotlib.font_manager as font_managerFile "/usr/lib64/python2.7/site-packages/matplotlib/font_manager.py", line 1469, in <module>    _rebuild()File "/usr/lib64/python2.7/site-packages/matplotlib/font_manager.py", line 1454, in _rebuild    json_dump(fontManager, _fmcache)File "/usr/lib64/python2.7/site-packages/matplotlib/font_manager.py", line 979, in json_dump    warnings.warn('Could not save font_manager cache ', e)TypeError: issubclass() arg 1 must be a class

Copy link

Choose a reason for hiding this comment

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

It doesn't seem to match the py3 version as well:

https://docs.python.org/3/library/warnings.html#warnings.warn

The function's 2nd argument takes an exception class, not an exception instance.

Copy link

Choose a reason for hiding this comment

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

@jklymak Can you take a look at this? If you want me to send a patch, no problem.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Ooops, well, at least its not worse than it was. A PR would be great, or if you aren't comfortable I could add one. Its pretty hard to test unless you get this error somehow.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Belay that - this code is not in master anymore, so it'll be fixed next release. Sorry about the inconveninece in this release.

Copy link
Member

@QuLogicQuLogicMar 21, 2018
edited
Loading

Choose a reason for hiding this comment

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

It's not inmaster, but it is in 2.2.2, so that may not be the next release. Though I suppose it technically might not count as a regression.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yeah I guess we could backport a fix onto 2.2.3 if there is one.

Copy link
Member

Choose a reason for hiding this comment

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

There will definitely be 2.2.3, 2.2 is going to keep getting bug-fix releases until 2020.

Copy link

Choose a reason for hiding this comment

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

It'd be no problem for me to send a PR. It's just that, at the time, I had a lot of other things to do so I just commented out here. Since you guys already have the repositories cloned and everything, it was the quicker solution.

Next time I'll create a PR. Thanks!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

@lmrlmrlmr left review comments

@QuLogicQuLogicQuLogic left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v2.1.1
Development

Successfully merging this pull request may close these issues.

failure on import due to IOError writing font cache
5 participants
@jklymak@tacaswell@anntzer@lmr@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp