Changed newlines to linesep from os.