Index: python-numpy/numpy/numarray/functions.py =================================================================== --- python-numpy.orig/numpy/numarray/functions.py 2011-01-11 11:20:24.582283357 -0500 +++ python-numpy/numpy/numarray/functions.py 2011-01-11 11:22:06.513172853 -0500 @@ -214,7 +214,7 @@ ##quick -- only one allocation will be needed. recsize = dtype.itemsize * np.product([i for i in shape if i != -1]) - blocksize = max(_BLOCKSIZE/recsize, 1)*recsize + blocksize = int(max(_BLOCKSIZE/recsize, 1)*recsize) ##try to estimate file size try: @@ -225,7 +225,7 @@ except (AttributeError, IOError): initsize=blocksize else: - initsize=max(1,(endpos-curpos)/recsize)*recsize + initsize = int(max(1,(endpos-curpos)/recsize)*recsize) buf = np.newbuffer(initsize) @@ -256,7 +256,7 @@ except IOError: _warnings.warn("Could not rewind (IOError in seek)", FileSeekWarning) - datasize = (len(data)/recsize) * recsize + datasize = int((len(data)/recsize) * recsize) if len(buf) != bytesread+datasize: buf=_resizebuf(buf,bytesread+datasize) buf[bytesread:bytesread+datasize]=data[:datasize] @@ -270,6 +270,19 @@ np.not_equal(a, 0, a) return a + +# this function is referenced in the code above but not defined. adding +# it back. - phensley +def _resizebuf(buf,newsize): + "Return a copy of BUF of size NEWSIZE." + newbuf = np.newbuffer(newsize) + if newsize > len(buf): + newbuf[:len(buf)]=buf + else: + newbuf[:]=buf[:len(newbuf)] + return newbuf + + def fromstring(datastring, type=None, shape=None, typecode=None, dtype=None): dtype = type2dtype(typecode, type, dtype, True) if shape is None: