I got a pickled object (a list with a few numpy arrays in it) that was created on Windows and apparently saved to a file loaded as text, not in binary mode (ie. with
Newlines in Windows aren't just '\r', it's CRLF, or '\r\n'.
'\r'
'\r\n'
Give file.read().replace('\r\n', '\n') a try. You were previously deleting carriage returns that may not have actually been part of newlines.
file.read().replace('\r\n', '\n')