Mercurial > repos > trinity_ctat > analyze_differential_expression
changeset 3:b5d906ce0f06 draft
Adding some debugging statements.
author | trinity_ctat |
---|---|
date | Mon, 02 Oct 2017 13:29:07 -0400 |
parents | 6f54e220d035 |
children | 08f897c2b57e |
files | analyze_diff_exp_wrapper.py |
diffstat | 1 files changed, 16 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/analyze_diff_exp_wrapper.py Mon Oct 02 12:55:27 2017 -0400 +++ b/analyze_diff_exp_wrapper.py Mon Oct 02 13:29:07 2017 -0400 @@ -56,15 +56,26 @@ Cvalue=sys.argv[4] def run_command(cmd): - print "The command used: " + cmd - pipe= subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE) - pipe.wait() - ret= pipe.returncode + # 2017-10-02 + # Cicada Dennis put the subprocess command in a try/except statement. + # Errors were going undetected the way it was written previously. + try: + pipe = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE) + cmd_stdout, cmd_stderr = pipe.communicate() + except: + msg = "ERROR while running command:\n\t" + cmd + sys.stderr.write(msg) + raise + + sys.stdout.write(cmd_stdout) + ret = pipe.returncode if ret: print "command died: " + str(ret) - print pipe.stderr.readlines() + sys.stderr.write(cmd_stderr) sys.exit(ret) else: + # Any error output written to stdout instead of stderr, since no error has occurred. + sys.stderr.write(cmd_stderr) return print ""