Graceful handling of errors from rsvg-convert
This commit is contained in:
parent
72626279c2
commit
e56042c41a
@ -124,11 +124,14 @@ def show(data, mode, width, height):
|
||||
|
||||
def convert_svg(path):
|
||||
try:
|
||||
return subprocess.check_output(['rsvg-convert', '-f', 'png', path])
|
||||
with open(os.devnull, 'wb') as null:
|
||||
return subprocess.check_output(['rsvg-convert', '-f', 'png', path], stderr=null)
|
||||
except OSError:
|
||||
raise SystemExit(
|
||||
'Could not find the program rsvg-convert, needed to display svg files'
|
||||
)
|
||||
except subprocess.CalledProcessError:
|
||||
raise OpenFailed(path, 'rsvg-convert could not process the image')
|
||||
|
||||
|
||||
def process(path, mt):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user