stdout can be None

This commit is contained in:
Valentin Valls 2019-03-22 09:27:35 +01:00
parent 2fe2b1075c
commit 61e803518f
1 changed files with 2 additions and 1 deletions

View File

@ -170,7 +170,8 @@ class Massif(object):
nbFailure += 1 nbFailure += 1
continue continue
if (region2[int(xopt[0] + 0.5), int(xopt[1] + 0.5)]) and not (xopt in listpeaks): if (region2[int(xopt[0] + 0.5), int(xopt[1] + 0.5)]) and not (xopt in listpeaks):
stdout.write("[ %4i, %4i ] --> [ %5.1f, %5.1f ] after %3i iterations %s" % (tuple(j) + tuple(xopt) + (nbFailure, os.linesep))) if stdout:
stdout.write("[ %4i, %4i ] --> [ %5.1f, %5.1f ] after %3i iterations %s" % (tuple(j) + tuple(xopt) + (nbFailure, os.linesep)))
listpeaks.append(xopt) listpeaks.append(xopt)
nbFailure = 0 nbFailure = 0
else: else: