Skip to content

Commit 1fe1805

Browse files
committed
removed possible backend ambiguity from memleak_gui.py
svn path=/trunk/matplotlib/; revision=3446
1 parent 45a9968 commit 1fe1805

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

unit/memleak_gui.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
import os, sys, time
1717
import gc
1818
from optparse import OptionParser
19-
import matplotlib
20-
import pylab
21-
from matplotlib import _pylab_helpers as ph
22-
import matplotlib.cbook as cbook
2319

2420
parser = OptionParser()
2521
parser.add_option("-q", "--quiet", default=True,
@@ -36,16 +32,20 @@
3632
# The following overrides matplotlib's version of the -d option
3733
# uses it if found
3834
parser.add_option("-d", "--backend", dest="backend",
39-
default=matplotlib.rcParams['backend'],
35+
default='',
4036
help="backend")
4137

4238

4339
options, args = parser.parse_args()
4440

4541
indStart = int(options.start)
4642
indEnd = int(options.end)
43+
import matplotlib
4744
matplotlib.rcParams['toolbar'] = matplotlib.validate_toolbar(options.toolbar)
48-
matplotlib.rcParams['backend'] = matplotlib.validate_backend(options.backend)
45+
if options.backend:
46+
matplotlib.use(options.backend)
47+
import pylab
48+
import matplotlib.cbook as cbook
4949

5050
for i in range(indEnd+1):
5151

@@ -63,13 +63,13 @@
6363
gc.collect()
6464
end = val
6565

66-
print
67-
print 'uncollectable list:', gc.garbage
68-
print
66+
print '#'
67+
print '# uncollectable list:', gc.garbage
68+
print '#'
6969

7070
if i > indStart:
71-
print 'Backend %(backend)s, toolbar %(toolbar)s' % matplotlib.rcParams
72-
print 'Averaging over loops %d to %d' % (indStart, indEnd)
73-
print 'Memory went from %dk to %dk' % (start, end)
74-
print 'Average memory consumed per loop: %1.4fk bytes\n' % ((end-start)/float(indEnd-indStart))
71+
print '# Backend %(backend)s, toolbar %(toolbar)s' % matplotlib.rcParams
72+
print '# Averaging over loops %d to %d' % (indStart, indEnd)
73+
print '# Memory went from %dk to %dk' % (start, end)
74+
print '# Average memory consumed per loop: %1.4fk bytes\n' % ((end-start)/float(indEnd-indStart))
7575

0 commit comments

Comments
 (0)