Skip to content
Snippets Groups Projects
Commit b70d5626 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

set universal_newlines flag in Popen

This enables string encoding in passed streams => stdout and stderr
parent 14674124
Branches
Tags
No related merge requests found
...@@ -185,16 +185,19 @@ def _RunCAD(tmp_dir, mode, cad_bin_path, old_regime): ...@@ -185,16 +185,19 @@ def _RunCAD(tmp_dir, mode, cad_bin_path, old_regime):
os.path.join(tmp_dir, os.path.join(tmp_dir,
"cadtemp")) "cadtemp"))
ps1=subprocess.Popen(command1, shell=True, stdout=subprocess.PIPE) ps1=subprocess.Popen(command1, shell=True, stdout=subprocess.PIPE,
universal_newlines=True)
ps1.wait() ps1.wait()
ps2=subprocess.Popen(command2, shell=True, stdout=subprocess.PIPE) ps2=subprocess.Popen(command2, shell=True, stdout=subprocess.PIPE,
universal_newlines=True)
ps2.wait() ps2.wait()
lines=ps2.stdout.readlines() lines=ps2.stdout.readlines()
try: try:
globalAA=_ParseCADGlobal(lines) globalAA=_ParseCADGlobal(lines)
except: except:
raise RuntimeError("CAD calculation failed") raise RuntimeError("CAD calculation failed")
ps3=subprocess.Popen(command3, shell=True, stdout=subprocess.PIPE) ps3=subprocess.Popen(command3, shell=True, stdout=subprocess.PIPE,
universal_newlines=True)
ps3.wait() ps3.wait()
lines=ps3.stdout.readlines() lines=ps3.stdout.readlines()
try: try:
...@@ -225,7 +228,8 @@ def _RunCAD(tmp_dir, mode, cad_bin_path, old_regime): ...@@ -225,7 +228,8 @@ def _RunCAD(tmp_dir, mode, cad_bin_path, old_regime):
if old_regime: if old_regime:
cmd.append("--old-regime") cmd.append("--old-regime")
cmd = ' '.join(cmd) cmd = ' '.join(cmd)
ps = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) ps = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
universal_newlines=True)
ps.wait() ps.wait()
try: try:
globalAA = _ParseVoronotaGlobal(ps.stdout.readlines()) globalAA = _ParseVoronotaGlobal(ps.stdout.readlines())
...@@ -246,11 +250,9 @@ def _RunCAD(tmp_dir, mode, cad_bin_path, old_regime): ...@@ -246,11 +250,9 @@ def _RunCAD(tmp_dir, mode, cad_bin_path, old_regime):
def _HasInsertionCodes(model, reference): def _HasInsertionCodes(model, reference):
for r in model.residues: for r in model.residues:
if r.GetNumber().GetInsCode() != "\0": if r.GetNumber().GetInsCode() != "\0":
print(r)
return True return True
for r in reference.residues: for r in reference.residues:
if r.GetNumber().GetInsCode() != "\0": if r.GetNumber().GetInsCode() != "\0":
print(r)
return True return True
return False return False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment