Skip to content

Commit 90a8cd4

Browse files
committed
why error w/subprocess still running? try changing order of .terminate
1 parent e860527 commit 90a8cd4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

GSASII/nistlat.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ def ReduceCell(center, cellin, mode=0, deltaV=0, output=None):
187187
print(line)
188188
return celldict
189189
finally:
190+
p.terminate()
190191
p.stdout.close()
191192
p.stderr.close()
192-
p.terminate()
193193
if len(celldict['output']) == 0 or len(err) > 0:
194194
print('Error:' ,err.decode())
195195
return celldict
@@ -254,9 +254,9 @@ def ConvCell(redcell):
254254
return None
255255
#return cell
256256
finally:
257+
p.terminate()
257258
p.stdout.close()
258259
p.stderr.close()
259-
p.terminate()
260260
if len(err) > 0:
261261
print('Error:' ,err.decode())
262262
return (cell,center,setting,mat)
@@ -324,9 +324,9 @@ def CompareCell(cell1, center1, cell2, center2, tolerance=3*[0.2]+3*[1],
324324
if output: fp = open(output,'w')
325325
# read output and parse
326326
lines = [b.decode() for b in p.stdout.readlines()]
327+
p.terminate()
327328
p.stdout.close()
328329
p.stderr.close()
329-
p.terminate()
330330
if fp:
331331
for line in lines: _emulateLP(line,fp)
332332
fp.close()
@@ -446,9 +446,9 @@ def CellSymSearch(cellin, center, tolerance=3*[0.2]+3*[1], mode=0,
446446

447447
d = 1
448448
lines = [b.decode() for b in p.stdout.readlines()]
449+
p.terminate()
449450
p.stdout.close()
450451
p.stderr.close()
451-
p.terminate()
452452
fp = None
453453
if output: fp = open(output,'w')
454454
if fp:
@@ -571,9 +571,9 @@ def CellSymSearch(cellin, center, tolerance=3*[0.2]+3*[1], mode=0,
571571
print(line)
572572
return celldict
573573
# finally:
574+
# p.terminate()
574575
# p.stdout.close()
575576
# p.stderr.close()
576-
# p.terminate()
577577
if len(symCellList) == 0 or len(err) > 0:
578578
print('Error:' ,err.decode())
579579
return symCellList

0 commit comments

Comments
 (0)