Author: bugman Date: Fri Jul 19 20:04:24 2013 New Revision: 20423 URL: http://svn.gna.org/viewcvs/relax?rev=20423&view=rev Log: Fixes for the relax_disp.cpmgfit_execute user function backend. This would hang if CPMGFit produced error messages. Hopefully this is now fixed. Modified: branches/relax_disp/specific_analyses/relax_disp/cpmgfit.py Modified: branches/relax_disp/specific_analyses/relax_disp/cpmgfit.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/cpmgfit.py?rev=20423&r1=20422&r2=20423&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp/cpmgfit.py (original) +++ branches/relax_disp/specific_analyses/relax_disp/cpmgfit.py Fri Jul 19 20:04:24 2013 @@ -91,12 +91,18 @@ test_binary(binary) # Execute CPMGFit. - cmd = "%s -grid -xmgr -f \"%s\" | tee \"%s\"\n" % (binary, file_in, file_out) + cmd = "%s -grid -xmgr -f %s | tee %s\n" % (binary, file_in, file_out) print("\n\n%s" % cmd) - pipe = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=False) - - # Close the pipe. - pipe.stdin.close() + pipe = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE, close_fds=True) + + # Write to stderr. + for line in pipe.stderr.readlines(): + # Decode Python 3 byte arrays. + if hasattr(line, 'decode'): + line = line.decode() + + # Write. + sys.stderr.write(line) # Write to stdout. for line in pipe.stdout.readlines(): @@ -106,15 +112,6 @@ # Write. sys.stdout.write(line) - - # Write to stderr. - for line in pipe.stderr.readlines(): - # Decode Python 3 byte arrays. - if hasattr(line, 'decode'): - line = line.decode() - - # Write. - sys.stderr.write(line) def cpmgfit_input(dir=None, binary='cpmgfit', spin_id=None, force=False):