[pySDL2] Access Violation displaying image


I posted this question a few days ago on Stack Overflow (http://stackoverflow.com/questions/22631202/pysdl2-access-violation-displaying-image) but have yet to receive an answer. I wonder if anyone here can help me? I’m using SDL 2.0.3 and pySDL2 version 0.9.0

I’m trying to get started with pysdl2 on a windows machine. So far I have just got as far as copying-and-pasting the Hello World tutorial, just so I can see if it’s actually working! It isn’t.

import sys
import sdl2.ext

RESOURCES = sdl2.ext.Resources(file, “resources”)


window = sdl2.ext.Window(“Hello World!”, size=(640, 580))

factory = sdl2.ext.SpriteFactory(sdl2.ext.SOFTWARE)
sprite = factory.from_image(RESOURCES.get_path(“testimage.png”))

spriterenderer = factory.create_sprite_render_system(window)

processor = sdl2.ext.TestEventProcessor()


When I run the program, it briefly displays a window then crashes with this error:

Traceback (most recent call last):
File “test.py”, line 15, in
File “C:\Python27\lib\site-packages\sdl2\ext\sprite.py”, line 643, in render
surface.SDL_BlitSurface(sprites.surface, None, self.surface, r)
WindowsError: exception: access violation reading 0x03F3B000

although the address is different each time.

This only seems to happen on larger images - if I resize the image to 245 x 245 pixels or smaller, then it will display without complaint. I’m using Pillow for improved format support and get the same problem with bmp, png and jpg.

Edited to add:

Today, I’ve been poking at this again trying to understand. My test image that was 245x245 pixels wouldn’t work any more, unless I did something between creating the spriterenderer and calling render(sprite) on it - I added print sprite between those lines out of interest to see if there was actually something in the variable and there is, and it displays. Comment out the print line and it fails. Then I made the same image larger, 500x500 and got the access violation error again. I have no idea what it going on.

Thanks for any help you can give.