installing gasp (ImportError: No module named glib)

Asked by eoghainam on 2009-08-27

I'm trying to get GASP to work for Python 2.6 (winXP) so i can do the exersises in http://openbookproject.net//thinkCSpy to learn python.
when i try and import gasp I get the folowing error:

>>> import gasp

Traceback (most recent call last):
  File "<pyshell#18>", line 1, in <module>
    import gasp
  File "C:\Python26\lib\site-packages\gasp\__init__.py", line 15, in <module>
    from api import *
  File "C:\Python26\lib\site-packages\gasp\api.py", line 26, in <module>
    import backend
  File "C:\Python26\lib\site-packages\gasp\backend.py", line 31, in <module>
    from glib import GError
ImportError: No module named glib

I looked up glib and it appears that its part of gtk+ (or so I gathered from a google search) which seems to be working fine
importing gtk works fine but if i try importing glib i get
Traceback (most recent call last):
  File "<pyshell#21>", line 1, in <module>
    import glib
ImportError: No module named glib

any ideas how to fix this?

Question information

Language:
English Edit question
Status:
Answered
For:
GASP Core Edit question
Assignee:
No assignee Edit question
Last query:
2009-08-27
Last reply:
2010-01-10
Kasey (kclemans) said : #2

I was having the same problem. So I tried running the installer. When I ran the installer under Vista, it would give me 3 errors during installation. "Could not create: gasp-py2.6"; "Could not set key value: Python 2.6 gasp-0.3.2"; and "C:\Python26\Removegasp.ext" -u "C:\Python26\gasp-wininst.log". After a while, I tried running the installer with admin privileges and it didn't give me those error messages.

However, now when I try to run a simple program using GASP, I get an endless sequence of console errors and efforts to open a window and the window closes. Here is the text of the script I was trying to run:

from gasp import *

begin_graphics()

Line((200,100),(100,300))

update_when('key_pressed')

end_graphics()

I'm wondering if the problem with not getting GASP to work has to do with gtk+. I'm guessing that because the instructions for installing gasp said this:

BEGIN QUOTE:
3. Microsoft Windows

There is an .EXE installer for GASP which can be downloaded from launchpad.net. In order for GASP to work, you must install the following packages first:
PyGTK
PyCairo
PyGObject
GTK+

END QUOTE

Now, PyGTK, PyCairo, and PyGObject all have installers that are .exe and ran without issue on my system. The GTK+ didn't have that kind of installer. Not knowing which gtk+ to download, I downloaded the 23mb bundle with everything and followed the readme instructions to:

Then add the bin folder to your PATH. Make sure you have no other
versions of GTK+ in PATH. Run:
    pkg-config --cflags gtk+-2.0
and verify that it prints out something reasonable. Run:
    gtk-demo
and verify that it works.

The gtk-demo works fine on my system. The path only has one reference to the bin folder of GTK+.

Can you help with this problem?

Provide an answer of your own, or ask eoghainam for more information if necessary.

To post a message you must log in.