Fix IO encoding to stdout of python script