By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,414 Members | 1,251 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,414 IT Pros & Developers. It's quick & easy.

How to create a writeable buffer?

P: n/a
I'm trying to create an object (as a C extension) to support the buffer
interface and was getting "TypeError: buffer is read-only" errors. So I
had a look at the array object and it has the same problem:

$ python
>>import array
a=array.array('c', ['a', 'b', 'c'])
array('c', 'abc')
array('c', 'dbc')
TypeError: buffer is read-only

The array is a mutable (writable) object, and the array implements the
buffer interface and provides a 'getwritebuf' method.
(Python-2.4.4/Modules/arraymodule.c has an array_buffer_getwritebuf())
so why does it give "TypeError: buffer is read-only"?

Nov 20 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.