I solved using 'rb' instead of 'r' option in the open file task.
that would do it, if it's binary data, but you might as well so it "right":
matrix="".join(f.readlines())
readlines is giving you a list of the data, as separated by newline charactors ("\n") -- it was broken on Windows, because opening the file in text mode translated Windows newlines ("\r\n") to *nix style ones -- opening it in binary fixed that, but why use readlines at all? That's for text -- use read. However, even better is to use fromfile(), which creates an array form binary data in a file without puttin git in a string, first:
matrix = np.fromfile(f, dtype=np.int16)
by the way -- be careful of endian issues here -- if you are moving data among different machines. You could specify the endian-ness, for instance:
dt = numpy.dtype('<i2')
for a 16 bit little-endian integer.
-CHB
-Chris