diff options
author | Alexander Kabui | 2021-10-05 16:57:13 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-10-25 14:16:21 +0300 |
commit | 84f5c8a4384f29dfcb187ac5eed43551860b182b (patch) | |
tree | 85f4016794ce24fbc405ddea42b6deb61acf0678 /gn3/computations/wgcna.py | |
parent | 453570cbf22a92de72fa0401895c99a923831942 (diff) | |
download | genenetwork3-84f5c8a4384f29dfcb187ac5eed43551860b182b.tar.gz |
fix issues serializing byte string
Diffstat (limited to 'gn3/computations/wgcna.py')
-rw-r--r-- | gn3/computations/wgcna.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index 421e09c..4dd0985 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -33,8 +33,10 @@ def stream_cmd_output(socket, cmd: str): for line in iter(results.stdout.readline, b""): line = line.decode("utf-8").rstrip() + # xtodo emit the data -def process_image(image_loc: str) ->bytes: + +def process_image(image_loc: str) -> bytes: """encode the image""" try: @@ -65,8 +67,9 @@ def call_wgcna_script(rscript_path: str, request_data: dict): with open(generated_file, "r") as outputfile: output_file_data = json.load(outputfile) - output_file_data["image_data"] = process_image( - output_file_data["output"]["imageLoc"]) + # json format only supports unicode string// to get image data reconvert + output_file_data["output"]["image_data"] = process_image( + output_file_data["output"]["imageLoc"]).decode("ascii") if run_cmd_results["code"] != 0: return run_cmd_results |