mailr7609 - /1.3/generic_fns/dasha.py


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

Header


Content

Posted by edward on October 11, 2008 - 22:35:
Author: bugman
Date: Sat Oct 11 22:35:06 2008
New Revision: 7609

URL: http://svn.gna.org/viewcvs/relax?rev=7609&view=rev
Log:
Switched to using os.popen3 for executing Dasha.

This allows STDOUT and STDERR to be caught and sent to relax's STDOUT and 
STDERR.  Hence Dasha's
output is caught by the system tests, etc.


Modified:
    1.3/generic_fns/dasha.py

Modified: 1.3/generic_fns/dasha.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/dasha.py?rev=7609&r1=7608&r2=7609&view=diff
==============================================================================
--- 1.3/generic_fns/dasha.py (original)
+++ 1.3/generic_fns/dasha.py Sat Oct 11 22:35:06 2008
@@ -25,7 +25,7 @@
 
 # Python module imports.
 from math import pi
-from os import F_OK, access, chdir, getcwd, system
+from os import F_OK, access, chdir, getcwd, system, popen3
 from re import match, search
 from string import lower, split
 import sys
@@ -402,7 +402,23 @@
             raise RelaxFileError, ('dasha script', 'dasha_script')
 
         # Execute Dasha.
-        system(binary + ' < dasha_script | tee dasha_results')
+        stdin, stdout, stderr = popen3(binary)
+
+        # Get the contents of the script and pump it into Dasha.
+        script = open('dasha_script')
+        lines = script.readlines()
+        script.close()
+        for line in lines:
+            stdin.write(line)
+
+        # Close the pipe.
+        stdin.close()
+
+        # Write to stdout and stderr.
+        for line in stdout.readlines():
+            sys.stdout.write(line)
+        for line in stderr.readlines():
+            sys.stderr.write(line)
 
     # Failure.
     except:




Related Messages


Powered by MHonArc, Updated Sat Oct 11 22:40:04 2008