[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] pygame vs python2.5: pygame.image.frombuffer raises TypeError: char buffer type not available



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')


On Fri, May 16, 2008 at 8:44 AM, Sam Morris <sam@xxxxxxxxxxxxx> wrote:
I've run into a problem with pygame 1.7.1 when using Python 2.5, but not
prior versions.

       >>> import cairo
       >>> import pygame
       >>> s = cairo.ImageSurface (cairo.FORMAT_ARGB32, 256, 192)
       >>> i = pygame.image.frombuffer (s.get_data (), (256, 192), 'RGBA')
       Traceback (most recent call last):
         File "<stdin>", line 1, in <module>
       TypeError: char buffer type not available

I also tried this with pygame 1.8, with no luck.

Can anyone say whether this is likely to be a problem with Python, or
pygame, or my code? :)

--
Sam Morris <sam@xxxxxxxxxxxxx>