From 2cc2897fecc5f5f4d1338c33ef8197f7ebba140c Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Thu, 13 Jan 2022 15:23:49 +0300 Subject: read stdout data;handle exceptions --- gn3/computations/ctl.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gn3/computations/ctl.py b/gn3/computations/ctl.py index c4955a0..8f20b65 100644 --- a/gn3/computations/ctl.py +++ b/gn3/computations/ctl.py @@ -1,4 +1,5 @@ """module contains code to process ctl analysis data""" +import json from gn3.commands import run_cmd from gn3.computations.wgcna import dump_wgcna_data @@ -14,7 +15,11 @@ def call_ctl_script(data): try: cmd_results = run_cmd(cmd) print(cmd_results) - except Exception as e: - raise e + with open(temp_file_name,"r") as outputfile: + if cmd_results["code"] != 0: + return cmd_results + return json.load(outputfile) + - return "hello" + except Exception as e: + return str(e) -- cgit v1.2.3