Fix python 3 encoding of newline in export