8000 Ignore threading errors when preparing font cache · matplotlib/matplotlib@eaf0112 · GitHub
[go: up one dir, main page]

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

Appearance settings

Commit eaf0112

Browse files
committed
Ignore threading errors when preparing font cache
In Enscripten/WASM, this module can be imported, but doesn't work, so we can't fall back to `dummy_threading` at import-time as we used to do.
1 parent ac5b154 commit eaf0112

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/matplotlib/font_manager.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,9 +1086,12 @@ def __init__(self, size=None, weight='normal'):
10861086
self.ttflist = []
10871087

10881088
# Delay the warning by 5s.
1089-
timer = threading.Timer(5, lambda: _log.warning(
1090-
'Matplotlib is building the font cache; this may take a moment.'))
1091-
timer.start()
1089+
try:
1090+
timer = threading.Timer(5, lambda: _log.warning(
1091+
'Matplotlib is building the font cache; this may take a moment.'))
1092+
timer.start()
1093+
except RuntimeError:
1094+
timer = None
10921095
try:
10931096
for fontext in ["afm", "ttf"]:
10941097
for path in [*findSystemFonts(paths, fontext=fontext),
@@ -1101,7 +1104,8 @@ def __init__(self, size=None, weight='normal'):
11011104
_log.info("Failed to extract font properties from %s: "
11021105
"%s", path, exc)
11031106
finally:
1104-
timer.cancel()
1107+
if timer:
1108+
timer.cancel()
11051109

11061110
def addfont(self, path):
11071111
"""

0 commit comments

Comments
 (0)
0