Revision: 8958
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8958&view=rev
Author: efiring
Date: 2011-02-08 04:42:17 +0000 (Tue, 08 Feb 2011)
Log Message:
-----------
cbook.report_memory: restore compatibility with earlier subprocess versions
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py 2011-02-07 22:49:09 UTC (rev
8957)
+++ trunk/matplotlib/lib/matplotlib/cbook.py 2011-02-08 04:42:17 UTC (rev
8958)
@@ -1233,7 +1233,7 @@
def report_memory(i=0): # argument may go away
'return the memory consumed by process'
- from subprocess import Popen, PIPE, check_output
+ from subprocess import Popen, PIPE
pid = os.getpid()
if sys.platform=='sunos5':
a2 = Popen('ps -p %d -o osz' % pid, shell=True,
@@ -1248,7 +1248,13 @@
stdout=PIPE).stdout.readlines()
mem = int(a2[1].split()[0])
elif sys.platform.startswith('win'):
- a2 = check_output(["tasklist", "/nh", "/fi", "pid eq %d" % pid])
+ try:
+ a2 = Popen(["tasklist", "/nh", "/fi", "pid eq %d" % pid],
+ stdout=PIPE).stdout.read()
+ except OSError:
+ raise NotImplementedError(
+ "report_memory works on Windows only if "
+ "the 'tasklist' program is found")
mem = int(a2.strip().split()[-2].replace(',',''))
else:
raise NotImplementedError(
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins