File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -295,8 +295,13 @@ def get_fontconfig_fonts(fontext='ttf'):
295295 fontext = get_fontext_synonyms (fontext )
296296
297297 fontfiles = {}
298- pipe = subprocess .Popen (['fc-list' , '' , 'file' ], stdout = subprocess .PIPE )
299- output = pipe .communicate ()[0 ]
298+ try :
299+ pipe = subprocess .Popen (['fc-list' , '' , 'file' ], stdout = subprocess .PIPE )
300+ output = pipe .communicate ()[0 ]
301+ except OSError :
302+ # Calling fc-list did not work, so we'll just return nothing
303+ return fontfiles
304+
300305 if pipe .returncode == 0 :
301306 for line in output .split ('\n ' ):
302307 fname = line .split (':' )[0 ]
@@ -1242,8 +1247,11 @@ def is_opentype_cff_font(filename):
12421247 def fc_match (pattern , fontext ):
12431248 fontexts = get_fontext_synonyms (fontext )
12441249 ext = "." + fontext
1245- pipe = subprocess .Popen (['fc-match' , '-sv' , pattern ], stdout = subprocess .PIPE )
1246- output = pipe .communicate ()[0 ]
1250+ try :
1251+ pipe = subprocess .Popen (['fc-match' , '-sv' , pattern ], stdout = subprocess .PIPE )
1252+ output = pipe .communicate ()[0 ]
1253+ except OSError :
1254+ return None
12471255 if pipe .returncode == 0 :
12481256 for match in _fc_match_regex .finditer (output ):
12491257 file = match .group (1 )
You can’t perform that action at this time.
0 commit comments