checksum works in unix but not win32 os

Peter Hansen peter at engcorp.com
Tue Mar 29 21:31:43 EST 2005


GujuBoy wrote:
> i have the following code...which works fine in UNIX but then i move it
> over to WINDOWS XP and check the sum on the same file that i tested on
> unix and i get different results.
> 
> def checksum(fileobj):
>     filedata = array.array('B', fileobj.read())

Did you make sure you opened this "fileobj" using
"rb" instead of the default "r"?  Look for the
open() call that created it and put "rb" in... otherwise
CRLF combinations are converted to LF on input...

-Peter



More information about the Python-list mailing list