[Tutor] Problems with Importing into the Python Shell

Andrew Martin amartin7211 at gmail.com
Sat Jun 12 06:50:26 CEST 2010

Hey, everyone, I am new to programming and just downloaded Python 2.6 onto
my windows vista laptop. I am attempting to follow 4.11 of the tutorial
called "How to Think Like a Computer Scientist: Learning with Python v2nd
Edition documentation" (
http://openbookproject.net/thinkcs/python/english2e/ch04.html). However, I
am having some trouble. First off, I do not understand how to import things
into the python shell. I have a script I saved as chap03.py, but when I try
to import it into the python shell i get an error like this:

>>> from chap03 import *

Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    from chap03 import *
  File "C:/Python26\chap03.py", line 2
    print param param
SyntaxError: invalid syntax

The chap03.py file is a simple one that looks like this:
def print_twice(param):
    print param param

My second problem is that I need to install and import GASP in order to
follow the tutorial. When I tried to do import it, I ran into an error like
>>> from gasp import *

Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    from gasp import *
  File "C:\Python26\lib\site-packages\gasp\__init__.py", line 1, in <module>
    from api import *
  File "C:\Python26\lib\site-packages\gasp\api.py", line 1, in <module>
    import backend
  File "C:\Python26\lib\site-packages\gasp\backend.py", line 7, in <module>
    except ImportError: raise 'Pygame is not installed. Please install it.'
TypeError: exceptions must be old-style classes or derived from
BaseException, not str

Can anybody help me with this?

Thanks a lot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100612/4378141c/attachment.html>

More information about the Tutor mailing list