[Tutor] Error message

Steven D'Aprano steve at pearwood.info
Sun Aug 10 13:30:55 CEST 2014


On Sun, Aug 10, 2014 at 10:32:52AM +0100, RICHARD KENTISH wrote:
> Hi!
> 
> Ive installed Python 2.7.8 and pygame 1.9.1 onto a macbook pro 10.9.4 Mavericks.
> 
> The code is taken direct from the 'making games' book. Here it is pasted from idle:

Whenever you have a mysterious error in Python that doesn't appear to be 
an error on your part -- and I admit that as a beginner, it's hard to 
tell which errors are yours and which aren't -- it's always worth trying 
again running Python directly. IDEs like IDLE sometimes do funny things 
to the environment in order to provide an Integrated Development 
Environment, and occasionally they can interfere with the clean running 
of Python code. So, just to be sure, I suggest you try running your code 
again outside of IDLE:

* Save your code to a file (which I see you've already done).

* Open up a terminal so you have a command line.

* Change into the directory where your file is saved. Type this command:

  cd "/Users/richardkentish/Desktop/Python resources"

  then press ENTER.

* Run the file directly using Python by typing this command:

  python blankgame.py

  then press ENTER.

If the error goes away, and you either get no error at all, or a 
different error, then it may be a problem with IDLE. Copy and paste the 
error here, and we can advise further.

Having said all that, looking at the exception you get:

> Traceback (most recent call last):
>   File "/Users/richardkentish/Desktop/Python resources/blankgame.py", line 1, in <module>
>     import pygame, sys
>   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in <module>
>     from pygame.base import *
> ImportError: 
> dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 
> 2): no suitable image found.  Did find: 
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: 
> no matching architecture in universal wrapper

it looks to me like perhaps you have a version of Pygame which is not 
compatible with the Mac. How did you install it? I'm not a Mac expert 
(it's been about, oh, 17 years since I've used a Mac) but somebody else 
may be able to advise.


-- 
Steven


More information about the Tutor mailing list