def fromfile(file, dtype, count, *args, **kwargs):
try:<EOL><INDENT>return numpy.fromfile(file, dtype=dtype, count=count, *args, **kwargs)<EOL><DEDENT>except (TypeError, IOError):<EOL><INDENT>return numpy.frombuffer(file.read(count * numpy.dtype(dtype).itemsize),<EOL>dtype=dtype, count=count, *args, **kwargs)<EOL><DEDENT>
Wrapper around np.fromfile to support any file-like object.