On Fri, 2008-05-16 at 09:40 -0700, Brian Fisher wrote: > It's impossible to tell from what you posted whether the error occurs > on the pygame.image.frombuffer() call or the ImageSurface().get_data() > call, but knowing that is very important in determining where the > problem lies. > > so what do you get if you try to do this? > > >>> import cairo > >>> import pygame > >>> s = cairo.ImageSurface (cairo.FORMAT_ARGB32, 256, 192) > >>> buf = s.get_data() > >>> i = pygame.image.frombuffer (buf, (256, 192), 'RGBA') The exception is raised on the fifth line, that is, by pygame.image.frombuffer. It is raised during the call to PyObject_AsCharBuffer in pygame's src/image.c: /* breaking constness here, we should really not change this string */ if(PyObject_AsCharBuffer(buffer, (const char**)&data, &len) == -1) return NULL; The exception actually comes from the bowels of Python itself, from the get_buf function in <http://svn.python.org/view/python/branches/release25-maint/Objects/bufferobject.c?rev=60793&view=auto>. The same function can be seen in Python 2.4, at <http://svn.python.org/view/python/branches/release24-maint/Objects/bufferobject.c?rev=60793&view=auto>. -- Sam Morris http://robots.org.uk/ PGP key id 1024D/5EA01078 3412 EA18 1277 354B 991B C869 B219 7FDB 5EA0 1078
Attachment:
signature.asc
Description: This is a digitally signed message part