Skip to content

Commit 2e3f321

Browse files
committed
Improved error reporting in texmanager and backend_ps
svn path=/trunk/matplotlib/; revision=1572
1 parent 30903ce commit 2e3f321

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
New entries should be added at the top
22

3+
2005-07-29 Improved message reporting in texmanager and backend_ps - DSD
4+
35
2005-07-28 backend_gtk.py: update FigureCanvasGTK.draw() (needed due to the
46
recent expose_event() change) so that examples/anim.py works in the
57
usual way - SC

lib/matplotlib/backends/backend_ps.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,20 +1085,21 @@ def print_figure(self, outfile, dpi=72,
10851085

10861086
command = "latex -interaction=nonstopmode '%s'" % texfile
10871087
stdin, stdout, stderr = os.popen3(command)
1088-
verbose.report(''.join(stdout.readlines()), 'debug-annoying')
1089-
verbose.report(''.join(stderr.readlines()), 'helpful')
1088+
verbose.report(stdout.read(), 'debug-annoying')
1089+
verbose.report(stderr.read(), 'helpful')
10901090
command = 'dvips -R -T %fin,%fin -o %s %s' % (pw, ph, psfile, dvifile)
10911091
stdin, stdout, stderr = os.popen3(command)
1092-
verbose.report(''.join(stdout.readlines()), 'debug-annoying')
1093-
verbose.report(''.join(stderr.readlines()), 'helpful')
1092+
verbose.report(stdout.read(), 'debug-annoying')
1093+
verbose.report(stderr.read(), 'helpful')
10941094
os.remove(epsfile)
10951095
if ext.startswith('.ep'):
10961096
dpi = rcParams['ps.distiller.res']
1097-
command = 'gs -dBATCH -dNOPAUSE -dSAFER -r%d -sDEVICE=epswrite '% dpi + \
1098-
'-dLanguageLevel=2 -dEPSFitPage -sOutputFile=%s %s'% (epsfile, psfile)
1097+
command = 'gs -dBATCH -dNOPAUSE -dSAFER -r%d \
1098+
-sDEVICE=epswrite -dLanguageLevel=2 -dEPSFitPage \
1099+
-sOutputFile=%s %s'% (dpi, epsfile, psfile)
10991100
stdin, stdout, stderr = os.popen3(command)
1100-
verbose.report(''.join(stdout.readlines()), 'debug-annoying')
1101-
verbose.report(''.join(stderr.readlines()), 'helpful')
1101+
verbose.report(stdout.read(), 'debug-annoying')
1102+
verbose.report(stderr.read(), 'helpful')
11021103
shutil.move(epsfile, outfile)
11031104
else: shutil.move(psfile, outfile)
11041105

@@ -1114,8 +1115,8 @@ def print_figure(self, outfile, dpi=72,
11141115
else:
11151116
command = 'ps2ps -dSAFER -r%d %s %s'% (dpi, outfile, tmpfile)
11161117
stdin, stdout, stderr = os.popen3(command)
1117-
verbose.report(''.join(stdout.readlines()), 'debug-annoying')
1118-
verbose.report(''.join(stderr.readlines()), 'helpful')
1118+
verbose.report(stdout.read(), 'debug-annoying')
1119+
verbose.report(stderr.read(), 'helpful')
11191120
shutil.move(tmpfile, outfile)
11201121

11211122
class FigureManagerPS(FigureManagerBase):

lib/matplotlib/texmanager.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ def make_dvi(self, tex, force=0):
113113
if force or not os.path.exists(dvifile):
114114
command = self.get_tex_command(tex, fname)
115115
stdin, stdout, stderr = os.popen3(command)
116-
verbose.report(''.join(stdout.readlines()), 'debug-annoying')
117-
err = ''.join(stderr.readlines())
116+
verbose.report(stdout.read(), 'debug-annoying')
117+
err = stderr.read()
118118
if err: verbose.report(err, 'helpful')
119119

120120
# tex will put it's output in the current dir if possible, and
@@ -144,8 +144,8 @@ def make_png(self, tex, dpi, force=0):
144144
# see get_rgba for a discussion of the background
145145
if force or not os.path.exists(pngfile):
146146
stdin, stdout, stderr = os.popen3(command)
147-
verbose.report(''.join(stdout.readlines()), 'debug-annoying')
148-
err = ''.join(stderr.readlines())
147+
verbose.report(stdout.read(), 'debug-annoying')
148+
err = stderr.read()
149149
if err: verbose.report(err, 'helpful')
150150
return pngfile
151151

@@ -159,8 +159,8 @@ def make_ps(self, tex, dpi, force=0):
159159
if not os.path.exists(psfile):
160160
command = 'dvips -q -E -D %d -o "%s" "%s"'% (dpi, psfile, dvifile)
161161
stdin, stdout, stderr = os.popen3(command)
162-
verbose.report(''.join(stdout.readlines()), 'debug-annoying')
163-
err = ''.join(stderr.readlines())
162+
verbose.report(stdout.read(), 'debug-annoying')
163+
err = stderr.read()
164164
if err: verbose.report(err, 'helpful')
165165

166166
return psfile

0 commit comments

Comments
 (0)