File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -295,8 +295,13 @@ def get_fontconfig_fonts(fontext='ttf'):
295
295
fontext = get_fontext_synonyms (fontext )
296
296
297
297
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
+
300
305
if pipe .returncode == 0 :
301
306
for line in output .split ('\n ' ):
302
307
fname = line .split (':' )[0 ]
@@ -1242,8 +1247,11 @@ def is_opentype_cff_font(filename):
1242
1247
def fc_match (pattern , fontext ):
1243
1248
fontexts = get_fontext_synonyms (fontext )
1244
1249
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
1247
1255
if pipe .returncode == 0 :
1248
1256
for match in _fc_match_regex .finditer (output ):
1249
1257
file = match .group (1 )
You can’t perform that action at this time.
0 commit comments