From: Sebastian H. <ha...@ms...> - 2003-12-03 18:47:13
|
Hi, I would like to use memmap array more often - here are some comments: (Please look for lines with $$$$) >>> from numarray import memmap as mm >>> m = mm.open("C:/mm1", mode='w+', len=0) >>> n = m.insert(0,0) >>> a = na.array(buffer=n) X:\PrWin\wxPython\lib\PyCrust\PyCrustApp.py:1: DeprecationWarning: The 'buffer' keyword is deprecated. Use 'sequence' instead. Exception exceptions.AttributeError: "Memmap instance has no attribute '_mode'" in Traceback (most recent call last): File "<input>", line 1, in ? File "X:\PrWin\numarray\numarraycore.py", line 279, in array type = getTypeObject(sequence, type, typecode) File "X:\PrWin\numarray\numarraycore.py", line 223, in getTypeObject return Py2NumType[ _maxtype(sequence) ] KeyError $$$$ Is this a mistake on my part or should the error message be "better" ??? >>> a = na.array(buffer=n, type=na.UInt16, shape=(0,0,0)) >>> a.shape (0, 0, 0) >>> m <Memmap on file 'C:/mm1' with mode='w+', length=0, 1 slices> >>> a.resize((100,100,100)) >>> a.shape (100, 100, 100) >>> m.sync() >>> m.flush() Traceback (most recent call last): File "<input>", line 1, in ? File "X:\PrWin\numarray\memmap.py", line 501, in flush self._consolidate(filename) File "X:\PrWin\numarray\memmap.py", line 469, in _consolidate f.write(self._buffer(m, mlen)) File "X:\PrWin\numarray\memmap.py", line 317, in _buffer raise RuntimeError("Memmap no longer valid. (closed?)") RuntimeError: Memmap no longer valid. (closed?) >>> m <Memmap on file 'C:/mm1' with mode='w+', length=0, 1 slices> $$$$ Is this a bug ? My idea is to "prepare" the memmap file before I actually know the array dimensions that should go into it. Is that a good idea ? Thanks, Sebastian Haase |