From cfd8447f019c4a28299bf5bdc5a1a007d4e0bc38 Mon Sep 17 00:00:00 2001 From: Gabriel Studer <gabriel.studer@unibas.ch> Date: Wed, 20 Nov 2019 15:37:41 +0100 Subject: [PATCH] set universal_newlines flag in Popen This enables string encoding in passed streams => stdout and stderr --- modules/bindings/pymod/tmtools.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/bindings/pymod/tmtools.py b/modules/bindings/pymod/tmtools.py index 0d158d77f..7b26d50a8 100644 --- a/modules/bindings/pymod/tmtools.py +++ b/modules/bindings/pymod/tmtools.py @@ -80,7 +80,8 @@ def _RunTmAlign(tmalign, tmp_dir): else: tmalign_path=settings.Locate('tmalign', explicit_file_name=tmalign) command="\"%s\" \"%s\" \"%s\" -m \"%s\"" %(tmalign_path, model1_filename, model2_filename, os.path.join(tmp_dir,'matrix.txt')) - ps=subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + ps=subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, + universal_newlines=True) ps.wait() lines=ps.stdout.readlines() if (len(lines))<22: @@ -128,7 +129,8 @@ def _RunMmAlign(mmalign, tmp_dir): else: mmalign_path=settings.Locate('MMalign', explicit_file_name=mmalign) command="\"%s\" \"%s\" \"%s\"" %(mmalign_path, model1_filename, model2_filename) - ps=subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + ps=subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, + universal_newlines=True) ps.wait() lines=ps.stdout.readlines() if (len(lines))<22: @@ -205,7 +207,8 @@ def _RunTmScore(tmscore, tmp_dir): tmscore_path=settings.Locate('tmscore', explicit_file_name=tmscore) command="\"%s\" \"%s\" \"%s\"" % (tmscore_path, model1_filename, model2_filename) - ps=subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + ps=subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, + universal_newlines=True) ps.wait() lines=ps.stdout.readlines() if (len(lines))<22: -- GitLab