def printLine(line, endLine="\n"): message = line + endLine message = tools.stdoutEncode(message) try: sys.stdout.write(message) except: pass
def printLine(line, endLine="\n", out=sys.stdout): message = line + endLine message = tools.stdoutEncode(message) try: out.write(message) except: pass out.flush()
def printLine(line, endLine="\n", out=None): # "out = sys.stdout" makes it hard to mock if out is None: out = sys.stdout message = line + endLine message = tools.stdoutEncode(message) try: out.write(message) except: pass out.flush()