From a016f291176a974e654c9387937057cb8f6aa250 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 20 Oct 2021 13:17:35 +0300 Subject: mypy fix for none stdout --- gn3/computations/wgcna.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'gn3/computations') diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index 76c71d5..0e49527 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -33,17 +33,20 @@ def stream_cmd_output(socketio, request_data, cmd: str): namespace="/", room=request_data["socket_id"]) results = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) - for line in iter(results.stdout.readline, b""): - line = line.decode("utf-8").rstrip() + if results.stdout is not None: - socketio.emit("output", - {"data": line}, namespace="/", room=request_data["socket_id"]) + for line in iter(results.stdout.readline, b""): - socketio.emit( - "output", {"data": - "parsing the output results"}, namespace="/", - room=request_data["socket_id"]) + line = line.decode("utf-8").rstrip() + + socketio.emit("output", + {"data": line}, namespace="/", room=request_data["socket_id"]) + + socketio.emit( + "output", {"data": + "parsing the output results"}, namespace="/", + room=request_data["socket_id"]) def process_image(image_loc: str) -> bytes: -- cgit v1.2.3