hello friends
i just start learning Python and i am going through book "how to think like a computer scientist", in forth chapter it start using "GASP" which needs to be installed and book totally ignored the need of a newbies regarding installation. so after some mucking around i did find out how to install. i am using Python2.6 on mac using Snow Leopard.
this is what i did to install gasp which i downloaded

sudo cp -R ~/Desktop/gasp-0.3.3/gasp/ /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/gasp

then i used command import gasp to test if it works and got this error massage

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import gasp
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/gasp/__init__.py", line 15, in <module>
    from api import *
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/gasp/api.py", line 26, in <module>
    import backend
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/gasp/backend.py", line 26, in <module>
    import cairo
ImportError: No module named cairo

Now can anyone suggest me please whats going wrong and help me understand this error massage.
Any help will be much appreciated
Thankyou

Well, if you have to learn from a book like this, that uses horribly outdated modules, you have to know that gasp is a wrapper using pygame. You need to install pygame to make gasp work. This might solve the problem with cairo. Cairo is normally part of the GTK GUI toolkit.

thankyou vegaseat i will try to install pygame and see if it works. About the outdated book you said can you suggest any new updated book which is good for newbies like me.
thankyou

i did download pygame package pygame-1.9.1 GASP and pygame both sitting in this loacation

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages

i am still getting same error massage

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import gasp
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/gasp/__init__.py", line 15, in <module>
    from api import *
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/gasp/api.py", line 26, in <module>
    import backend
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/gasp/backend.py", line 26, in <module>
    import cairo
ImportError: No module named cairo

any suggestions please.....

thankyou vegaseat i will try to install pygame and see if it works. About the outdated book you said can you suggest any new updated book which is good for newbies like me.
thankyou

The book has many good points, but the the graphics examples are outdated since they solely rely on a home-brew graphics module called gasp (appropriate name).

I think it is suggested to first install pygame and then gasp.

You can use module pygame directly to easily draw basic shapes. Most of the pygame code can be written as general template and you only have to add the shape draw function and its arguments. See:
http://www.daniweb.com/forums/showthread.php?p=1227811#post1227811

Edited 6 Years Ago by vegaseat: pygame

Well everybody, sorry for the incomplete sentences and overall poor English but I wanted to make this simple to read and understand for someone who is completely inexperienced in any sort of programming, as I am (very first day messing with this stuff, e.g., terminal). This is the result of hours of Googling that was all done in one day. Perhaps someone who is familiar with the commands below (in bold) wouldn’t mind explaining what exactly is taking place. Additionally, this was all done in terminal on a MacBook Pro running Mac OS Lion.

1. Install macport binary (comes with installer; easy)
2. sudo port install py-game
a. not sure if this is necessary, as it doesn’t appear to cause pygame to be functional
for python version 2.7.1 (stock python on lion)
3. sudo port select --set python python 2.7
a. I believe this set the default python version to 2.7.2 which I also believe was
downloaded during step 2 (therefore why I think this ends up being a necessary step)
4. Download setuptools-0.6c11-py2.7.tar
5. In folder gasp-0.3.4, which appears after clicking on the .tar, place setup.py in the
gasp folder
6. sudo python gasp/setup.py install
a. make sure your directory is the folder gasp-0.3.4
7. sudo port –v install py27-gtk
a. takes about an hour for this step to complete
8. sudo port uninstall py-game
a. this step is not necessary for gasp to work; I simply didn’t want any unnecessary
stuff on my computer that was downloaded during the second step; however, this step
put python 2.7.2 on my computer; could install 2.7.2 separately I guess but this way
worked for me; a lot of other unnecessary stuff is installed during this step too but
I think it’ll remain even after this command, oh well

This question has already been answered. Start a new discussion instead.