sympy/sympy-png-decoder.patch
Jerry James 39a9cfc04c Version 1.8.
- Drop the -float patch and only run tests on x86_64.
- Add -circuitplot patch to skip tests that fail with no display.
- Drop the -texmacs subpackage; the TeXmacs package ships its own sympy plugin.
2021-04-12 15:10:56 -06:00

23 lines
810 B
Diff

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