[Numpy-discussion] array is not writable

Charles R Harris charlesr.harris at gmail.com
Thu Aug 27 00:43:13 EDT 2009


On Wed, Aug 26, 2009 at 10:34 PM, David Warde-Farley <dwf at cs.toronto.edu>wrote:

> On 26-Aug-09, at 11:49 PM, Mark Wendell wrote:
>
> > Figured this much out: if I do an np.copy of the original array to a
> > new array, then I can edit individual 'color' values with impunity. So
> > I guess the original array from the pil object still shares memory
> > with that image object somehow, making it unwritable?
>
> I'm going to guess that it's because PIL is still responsible for that
> memory, not NumPy. I don't really know how this stuff works but
> asarray() would just give you a view onto that chunk of memory; since
> NumPy didn't allocate it, it probably doesn't want to modify it. Not
> sure if you can get away with not making a copy in this situation.
>

I expect you can. It's the unreadable arrays that are a problem...

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090826/18e9c237/attachment.html>


More information about the NumPy-Discussion mailing list