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

[pygame] Error handling non Windows BMP images



Hey all--

	I'm writing software that allows children to create their own video
games without having to learn how to program. I'm hoping to use pygame
to handle the graphics work I want to put into the next version, but am
having some trouble getting it up and running properly on my system.

	Half of the program is in pyGTK, which is only available pre-compiled
under RedHat 7.2 for python 1.5, while pygame wants to use python2. I
was able to get pygame 1.4 compiled by calling:

python2 setup.py

	and then tweaking all of the references to python2.1 in the Setup file
to say python1.5. This seemed to work with no problem, until I tried to
load a jpg image:

import pygame
import pygame.image
from pygame.locals import *

sprite_file = "../ImageFarm/Compass.jpg"

pygame.init()
screen =
	pygame.display.set_mode((640,480),HWSURFACE|DOUBLEBUF)               
background = pygame.Surface(screen.get_size())
background.fill((255,255,255))
sprite = pygame.image.load(sprite_file)
sprite_position = sprite.get_rect()
sprite_position.bottom = (480 / 2)
sprite_position.left = (640 / 2)
screen.blit(background, (0,0))
screen.blit(sprite, sprite_position)
pygame.display.flip()


	The interpreter breaks with the following error code:

WARNING: Python C API version mismatch for module surfarray:
  This Python has API version 1007, module surfarray has version 1010.
Traceback (innermost last):
  File "/usr/lib/python1.5/site-packages/libglade.py", line 28, in
__call__
    ret = apply(self.func, a)
  File "./utils.py", line 43, in __call__
    return apply(self.method, (self.dest,) + args)
  File "./CogDevApp.py", line 399, in on_play_button_clicked
    sprite = pygame.image.load(sprite_file)
pygame.error: File is not a Windows BMP file


	I'm not certain whether this problem has something to do with the
Python C API version mismatch (using 1.5 instead of 2), or if I'm
perhaps missing some sort of dependecy for image work (SDL_image is
installed, and imageext is enabled in the setup file)


	I did try getting pygtk to work with the python2 install, but had some
trouble getting the libglade module to behave. I have a lot of other
site-packages for python 1.5 that I would like to use, so I would prefer
sticking to that version if at all possible, but wanted to hear what you
guys think first.



Cheers,

-Steve Castellotti
 SteveC@innocent.com
 http://cogengine.sourceforge.net/


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