In python3, I have had problems printing unicode characters to stdout, with the script failing, until I set this at the top of the file:
sys.stdout = codecs.getwriter('utf8')(sys.stdout.buffer)
but this then buffers the output, and I'd like to see the output as it is generated, line-by-line. What should I alter to stop the buffering?