Skip to content

Commit c3087c8

Browse files
Merge pull request sympy#19904 from eric-wieser/fix-preview
printing.preview: Fix regressions introduced in sympygh-18392
2 parents 2c5e319 + 885e45a commit c3087c8

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

sympy/printing/preview.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import print_function, division
22

33
import io
4-
from io import BytesIO
54
import os
65
from os.path import join
76
import shutil
@@ -136,11 +135,9 @@ def preview(expr, output='png', viewer=None, euler=True, packages=(),
136135
except KeyError:
137136
raise SystemError("Invalid output format: %s" % output)
138137
else:
139-
if viewer == "StringIO":
140-
viewer = "BytesIO"
141-
if outputbuffer is None:
142-
raise ValueError("outputbuffer has to be a BytesIO "
143-
"compatible object if viewer=\"StringIO\"")
138+
if viewer == "file":
139+
if filename is None:
140+
raise ValueError("filename has to be specified if viewer=\"file\"")
144141
elif viewer == "BytesIO":
145142
if outputbuffer is None:
146143
raise ValueError("outputbuffer has to be a BytesIO "
@@ -250,13 +247,7 @@ def preview(expr, output='png', viewer=None, euler=True, packages=(),
250247
src = "texput.%s" % (output)
251248

252249
if viewer == "file":
253-
if filename is None:
254-
buffer = BytesIO()
255-
with open(join(workdir, src), 'rb') as fh:
256-
buffer.write(fh.read())
257-
return buffer
258-
else:
259-
shutil.move(join(workdir,src), filename)
250+
shutil.move(join(workdir, src), filename)
260251
elif viewer == "BytesIO":
261252
with open(join(workdir, src), 'rb') as fh:
262253
outputbuffer.write(fh.read())

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy