views:

813

answers:

1

Hey all.

I'm currently trying to learn Python and am going through How to Think Like a Computer Scientist: Learning With Python. I have installed Python 2.6.2 on Mac OSX 10.4.11 and am using the IDLE.

At the end of chapter 4 Elkner et al. refer to GASP. However their instructions don't work as when I enter:

>>> from gasp import*

I get:

Traceback (most recent call last):
  File "<pyshell#17>", line 1, in <module>
    from gasp import*
ImportError: No module named gasp

I've had a look around on google and can only find outdated methods of installation or pages of gobbledegook. I believe I have to install PyObjC first and haven't been able to accomplish this either.

Can anyone please help me out with some plain English instructions?

+1  A: 

This is actually somewhat of a coincidence; I'm one of the packagers of GASP. On our download page, which is linked by our main project page, there are instructions on how to install it on most major platforms. Hadn't considered OSX, however. Will write something up shortly.

Essentially, install the Official Python from the PSF. Then add MacPorts and run

sudo ports install py-game

Extract the source tarball from the download page linked above to your site-packages directory.

There are also some alternative instructions I found that might work better, as I have not tested the above.

lfaraone
unfortunately it appears PyGame does require PyObjC. I have tried installing from their site but in order to install PyGame and the PyObjC file the installer states that the program requires System Python 2.5 to install. Any ideas? Is this because I have Python 2.6.2 and thats not supported?
Luke
It's supported. I guess nobody on our development team considered OSX when we wrote GASP, so the instructions are lacking. What it means is that you need to install the python from Python.Org, rather than the one that comes in with OSX. See also http://www.theartfulscientist.com/2008/03/16/how-to-install-pyobjc-pygame-and-gasp-on-mac-os-x-for-python-tutorial/
lfaraone
@lfarone: Looks like nobody on your development team reads their own FAQ `https://answers.launchpad.net/gasp-code/+faq/42` which doesn't mention installing a new Python, nor pyObjC
John Machin
I dont think OSX ships with Python 2.6.2 - Tiger certainly didnt and so I did unstall from Python.org. The PyGame site also says you need to install a version from Python.org and not use the System Python.
Luke
@john-machin, moderately amusing, since I wrote that. of course, we didn't really look into it too well and as you can see by this post, additional packages are required.
lfaraone
Note: the MacPorts program is named port not ports.
titaniumdecoy