From: Travis O. <oli...@ie...> - 2006-08-28 23:32:30
|
Christopher Barker wrote: > HI all, > > File > "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", > line 2814, in SetDataBuffer > return _core_.Image_SetDataBuffer(*args, **kwargs) > TypeError: non-character array cannot be interpreted as character buffer > > If I try to pass in a numpy array, while it works great with a > numarray array. This error sounds like wx is using the *wrong* buffer protocol. Don't use bf_getcharbuffer as it is of uncertain utility. It is slated for removal from Python 3000. It was meant to be used as a way to determine buffers that were supposed to contain characters (not arbitrary data). Just use bf_getreadbuffer and bf_getwritebuffer from tp_as_buffer. More support for the buffer protocol all the way around is a good idea. NumPy has always supported it very well (just make sure to use it correctly). FYI, I'm going to write a PEP to get the array protocol placed as an add-on to the buffer protocol for Python 2.6 -Travis |