import os
data = map(lambda c: ord(c), file(args[0]).read(os.path.getsize(args[0])))
For one file, os.path.getsize(args[0]) returns 10456 while len(data) returns 281.
After looking at different files, I realized that it always stops reading at the 0x1A character.
The documentation says that in Windows, Python uses _wfopen which (for compatibility reasons) interprets 0x1A (CTRL-Z in DOS) as the end-of-file.
Does anyone know how to read an entire binary file which may contain 'x1A'?