mailr17602 - /trunk/info.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on September 28, 2012 - 17:22:
Author: bugman
Date: Fri Sep 28 17:22:32 2012
New Revision: 17602

URL: http://svn.gna.org/viewcvs/relax?rev=17602&view=rev
Log:
Python 3 preparations - eliminated the use of the os.popen3 function from the 
info module.


Modified:
    trunk/info.py

Modified: trunk/info.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/info.py?rev=17602&r1=17601&r2=17602&view=diff
==============================================================================
--- trunk/info.py (original)
+++ trunk/info.py Fri Sep 28 17:22:32 2012
@@ -27,7 +27,7 @@
 if hasattr(ctypes, 'windll'):
     import ctypes.wintypes
 import numpy
-from os import environ, popen3, waitpid
+from os import environ, waitpid
 import platform
 from string import split
 from subprocess import PIPE, Popen
@@ -490,8 +490,8 @@
         text = ''
 
         # Unix and GNU/Linux systems.
-        stdin, stdout, stderr = popen3('free -m')
-        free_lines = stdout.readlines()
+        pipe = Popen('free -m', shell=True, stdin=PIPE, stdout=PIPE, 
stderr=PIPE, close_fds=False)
+        free_lines = pipe.stdout.readlines()
         if free_lines:
             # Extract the info.
             for line in free_lines:
@@ -765,7 +765,7 @@
             if name == 'page_last':
                 return vals[1]
 
-        raise AttributeError, name
+        raise AttributeError(name)
 
 
     def cite_short(self, author=True, title=True, journal=True, volume=True, 
number=True, pages=True, year=True, doi=True, url=True, status=True):




Related Messages


Powered by MHonArc, Updated Fri Sep 28 17:40:01 2012