sympy/sympy-png-decoder.patch

23 lines
810 B
Diff
Raw Normal View History

diff --git a/sympy/printing/preview.py b/sympy/printing/preview.py
index 52085e5e19..f9b1d2dd5c 100644
--- a/sympy/printing/preview.py
+++ b/sympy/printing/preview.py
@@ -27,12 +27,12 @@ def _check_output_no_window(*args, **kwargs):
def _run_pyglet(fname, fmt):
from pyglet import window, image, gl
from pyglet.window import key
+ from pyglet.image.codecs import ImageDecodeException
- if fmt == "png":
- from pyglet.image.codecs.png import PNGImageDecoder
- img = image.load(fname, decoder=PNGImageDecoder())
- else:
- raise ValueError("pyglet preview works only for 'png' files.")
+ try:
+ img = image.load(fname)
+ except ImageDecodeException:
+ raise ValueError("pyglet preview does not work for '{}' files.".format(fmt))
offset = 25