[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Segfault in pygame.image.tostring()?



On Fri, 7 Mar 2003, Pete Shinners wrote:

> Jasper Phillips wrote:
> > I'm trying to save screen shots as .png's using PIL, but I'm getting
> > a segfault in a pygame when I try to convert the screen image into
> > a string:
> >
> > Has anyone else seen anything like this, or have any ideas what could
> > cause this?
> 
> looks like you are using everything correct, which seems to point to a 
> bug in my code. can you send me the following info on the image..
> 
>      print screen.get_bytesize()
>      print screen.get_flags()
>      print screen.get_masks()

bytesize: 4
flags:    1073741826
printing the masks throws an error:
TypeError: not all arguments converted

> likely some problem with whatever format is being used, perhaps a 
> locking issue? should be easy to fix once we're a little closer to the 
> problem.

D'oh.  It must be time for me to get some sleep, as I didn't provide
enough details. :-/

I suspect it's something with how I'm using pyui.  In particular I have
no problem converting surfaces to strings in order to setup an opengl texture
(although I'm not using display.get_surface() there).

I'm running pyui, and after hitting escape (ending pyui.run()), I call
my saveScreen() method:

if __name__ == '__main__':
    client = Client()
    client.start()       # Right now -> pyui.run()
    client.saveScreen()  # per previous email
    client.quit()        # Right now -> pyui.quit()

Perhaps something unexpected happens when pyui.run() ends, causing the
screen shot to be in an odd saveable but not exportable state?  A quick look
through pyui doesn't show anything untoward, as all the destructive code seems
to stem from pyui.quit()...  Then again, I'm not finding where the escape
keypress is handled.

Grrr!  Looks like there's a bug in microsoft's lame file search, as searching
for "EVENT" in pyui turns up nothing, while it's clearly present.  I guess I
should install cygwin afterall!

Definitely time to take a nap, as I'm getting brain fog.

-Jasper

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org