Fix export when cairosvg module is not found
If not found, the program should not try to export the image using it anyway.master
parent
deb2e031a1
commit
01f90de9c2
|
@ -114,21 +114,22 @@ def generate_outfile(
|
|||
)
|
||||
log.debug(e)
|
||||
|
||||
svg_str = jj2_tpl.render(context)
|
||||
else:
|
||||
svg_str = jj2_tpl.render(context)
|
||||
|
||||
if outfilename.suffix == ".png":
|
||||
conversion_fun = cairosvg.svg2png
|
||||
elif outfilename.suffix == ".pdf":
|
||||
conversion_fun = cairosvg.svg2pdf
|
||||
elif outfilename.suffix == ".ps":
|
||||
conversion_fun = cairosvg.svg2ps
|
||||
if outfilename.suffix == ".png":
|
||||
conversion_fun = cairosvg.svg2png
|
||||
elif outfilename.suffix == ".pdf":
|
||||
conversion_fun = cairosvg.svg2pdf
|
||||
elif outfilename.suffix == ".ps":
|
||||
conversion_fun = cairosvg.svg2ps
|
||||
|
||||
conversion_fun(
|
||||
bytestring = svg_str,
|
||||
write_to = str(outfilename),
|
||||
)
|
||||
conversion_fun(
|
||||
bytestring = svg_str,
|
||||
write_to = str(outfilename),
|
||||
)
|
||||
|
||||
return outfilename
|
||||
return outfilename
|
||||
|
||||
# To unsupported format
|
||||
# -------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue