Commits

Nathan Goldbaum  committed 7f8face

Updating to use os.path.splitext. Thanks for the suggestion Kacper!

  • Participants
  • Parent commits cb26d14

Comments (0)

Files changed (1)

File yt/visualization/image_writer.py

     else:
         dpi = None
 
-    if filename[-4:] in ['.png','.pdf','.eps']:
-        suffix = filename[-4:]
-    elif filename[-3:] == ['.ps']:
-        suffix = filename[-3:]
-    else:
+    suffix = os.path.splitext(filename)[1]
+
+    if suffix not in ['.png','.pdf','.eps','.ps','']:
+        mylog.warning("Unknown suffix %s, defaulting to Agg", suffix)
+        canvas = FigureCanvasAgg(fig)
+    if suffix == '':
         suffix = '.png'
         filename = "%s%s" % (filename, suffix)
     mylog.info("Saving plot %s", filename)