about summary refs log tree commit diff
path: root/gn3/computations
diff options
context:
space:
mode:
authorAlexander Kabui2021-10-20 13:17:35 +0300
committerBonfaceKilz2021-10-25 14:16:21 +0300
commita016f291176a974e654c9387937057cb8f6aa250 (patch)
treea609b8f426d058db32a9752e67a08c2ec1d9276e /gn3/computations
parent7b8efdf2040b0f623d1736e5608338ddcbe4a9da (diff)
downloadgenenetwork3-a016f291176a974e654c9387937057cb8f6aa250.tar.gz
mypy fix for none stdout
Diffstat (limited to 'gn3/computations')
-rw-r--r--gn3/computations/wgcna.py19
1 files changed, 11 insertions, 8 deletions
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: