0

I am having a basic problem with pygame. I want to load a simple image given in tutorial for the package.

import pygame
catImg = pygame.image.load('cat.png')

and get the following error :

error: File is not a Windows BMP file   

I saw this question asked countless times with answers to reinstall pygame and install image packages (PIL, Pillow) . I tried all of those but it still does not work. I have reinstalled pygame a lot of times by now and it still does not support more formats.

>>pygame.image.get_extended()
>> 0

I am using Python 2.7.14 |Anaconda custom (64-bit)| (default, Oct 5 2017, 02:28:52)

I installed PIL, Pillow with conda.

OSX is Mac OSX High Sierra 10.13.14.

$type python
python is hashed (/Users/username/anaconda2/bin/python)

and I simply do :

$ python
Python 2.7.14 |Anaconda custom (64-bit)| (default, Oct  5 2017, 02:28:52) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
>>> pygame.image.load('cat.png')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
pygame.error: File is not a Windows BMP file

or do the same in jupyter and the result is same.

$ python -V
Python 2.7.14 :: Anaconda custom (64-bit)
jkhadka
  • 2,443
  • 8
  • 34
  • 56
  • Maybe you should be clearer in your question about whether you are using Python2 or Python3, about how and where you installed Python, how and where you installed Pillow.... – Mark Setchell Sep 02 '18 at 21:52
  • oh sorry. yeah i will add all those. – jkhadka Sep 03 '18 at 07:04
  • Please show how you are running this - i.e. what command you type in Terminal. Please show the shebang at the start of your file. Please show the output of `type python`. Please show the output of `python -v`. – Mark Setchell Sep 03 '18 at 09:34

0 Answers0