From 4bb2241510854402af6668909ba059216409c3d8 Mon Sep 17 00:00:00 2001 From: Gabriel Studer <gabriel.studer@unibas.ch> Date: Wed, 20 Nov 2019 11:38:25 +0100 Subject: [PATCH] set universal_newlines flag in Popen This enables string encoding in passed streams => stdout and stderr --- modules/bindings/pymod/msms.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/bindings/pymod/msms.py b/modules/bindings/pymod/msms.py index 21ccf5125..b7d338e50 100644 --- a/modules/bindings/pymod/msms.py +++ b/modules/bindings/pymod/msms.py @@ -43,7 +43,8 @@ def GetVersion(msms_exe=None, msms_env=None): """ msms_executable = _GetExecutable(msms_exe, msms_env) command = "%s" % (msms_executable) - proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, + universal_newlines=True) stdout_value, stderr_value = proc.communicate() version = "" @@ -149,7 +150,8 @@ def _RunMSMS(command): :returns: stdout of MSMS :raises: :class:`CalledProcessError` for non-zero return value """ - proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, + universal_newlines=True) stdout_value, stderr_value = proc.communicate() #check for successful completion of msms -- GitLab