Revision: 7064
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7064&view=rev
Author:   ryanmay
Date:     2009-04-24 17:08:50 +0000 (Fri, 24 Apr 2009)

Log Message:
-----------
Use subprocess.Popen instead of os.popen to retrieve memory usage.  os.popen* 
are deprecated in Python 2.6.

Modified Paths:
--------------
    trunk/matplotlib/CHANGELOG
    trunk/matplotlib/lib/matplotlib/cbook.py

Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG  2009-04-24 16:53:44 UTC (rev 7063)
+++ trunk/matplotlib/CHANGELOG  2009-04-24 17:08:50 UTC (rev 7064)
@@ -1,6 +1,9 @@
 ======================================================================
 
-2009-04-20 Worked on axes_grid documentation. Added 
+2009-04-24 Changed use of os.open* to instead use subprocess.Popen.
+           os.popen* are deprecated in 2.6 and are removed in 3.0. - RMM
+
+2009-04-20 Worked on axes_grid documentation. Added
            axes_grid.inset_locator. - JJL
 
 2009-04-17 Initial check-in of the axes_grid toolkit. - JJL
@@ -16,12 +19,11 @@
            an rasterizing backend are placed with incorrect size.
            - JJL
 
-2008-04-14 Added Jonathan Taylor's Reinier Heeres' port of John
+2009-04-14 Added Jonathan Taylor's Reinier Heeres' port of John
            Porters' mplot3d to svn trunk.  Package in
            mpl_toolkits.mplot3d and demo is examples/mplot3d/demo.py.
            Thanks Reiner
 
-
 2009-04-06 The pdf backend now escapes newlines and linefeeds in strings.
            Fixes sf bug #2708559; thanks to Tiago Pereira for the report.
 

Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py    2009-04-24 16:53:44 UTC (rev 
7063)
+++ trunk/matplotlib/lib/matplotlib/cbook.py    2009-04-24 17:08:50 UTC (rev 
7064)
@@ -903,15 +903,19 @@
 
 def report_memory(i=0):  # argument may go away
     'return the memory consumed by process'
+    from subprocess import Popen, PIPE
     pid = os.getpid()
     if sys.platform=='sunos5':
-        a2 = os.popen('ps -p %d -o osz' % pid).readlines()
+        a2 = Popen('ps -p %d -o osz' % pid, shell=True,
+            stdout=PIPE).stdout.readlines()
         mem = int(a2[-1].strip())
     elif sys.platform.startswith('linux'):
-        a2 = os.popen('ps -p %d -o rss,sz' % pid).readlines()
+        a2 = Popen('ps -p %d -o rss,sz' % pid, shell=True,
+            stdout=PIPE).stdout.readlines()
         mem = int(a2[1].split()[1])
     elif sys.platform.startswith('darwin'):
-        a2 = os.popen('ps -p %d -o rss,vsz' % pid).readlines()
+        a2 = Popen('ps -p %d -o rss,vsz' % pid, shell=True,
+            stdout=PIPE).stdout.readlines()
         mem = int(a2[1].split()[0])
 
     return mem


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to