[Tutor] pygame error

Steven D'Aprano steve at pearwood.info
Fri Nov 29 09:54:38 CET 2013


On Thu, Nov 28, 2013 at 12:43:17AM +0530, Vipul Sharma wrote:
> Hello ! I am a beginner in pygame, i was just trying a simple pygame
> program where I wanted to load an image (.png) from the same directory
> where my actual source code was.
> I wrote this line in my source code to load the image :
> 
> Img = pygame.image.load('cat.png')
> 
> But I got a traceback :
> 
> pygame.error: File is not a Windows BMP file
> 
> Can anyone pls tell what is the problem with the code, why this error
> arises ?

Is the error message not clear enough? The file is a PNG file, not a
Windows BMP file.

By default, pygame only supports BMP images. If you want to use a more
useful range of image types, like PNG, JPG, and so forth, you need to
build pygame with image support.

See here for more information:

http://www.pygame.org/docs/ref/image.html



-- 
Steven


More information about the Tutor mailing list