[Tutor] Using Python in Windows

Ben ben at pacificu.edu
Wed Jun 25 03:27:59 CEST 2008


Hi,

I'm trying to learn Python in Windows XP. I've been going through the
Python version of Allen Downey's open source textbook. I frequently
find that the instructions he gives don't work for me when I try to
run them in IDLE. For example, in Ch. 4 he says you should load up
GASP (http://openbookproject.net//thinkCSpy/ch04.xhtml#auto10) and
play around with it. Here's what happens when I try what he says to
do:

IDLE 1.2.2
>>> from gasp import *

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

When I try to put all the information in a module, save it, and run
it, I get "there's an error in your program: invalid syntax", and it
highlights instance. Below is what my module looks like.

from gasp import *
begin_graphics()
Circle((200, 200), 60)
Circle instance at (200, 200) with radius 60
Line((100, 400), (580, 200))
Line instance from (100, 400) to (590, 250)
Box((400, 350), 120, 100)
Box instance at (400, 350) with width 120 and height 100
end_graphics()

Similarly, I can't get the truth table to work in the Exercises
section at the bottom of ch. 4. I'm wondering if this is because I'm
using Windows. I've tried using Ubuntu, and it doesn't display
correctly.

Thanks,
Ben


More information about the Tutor mailing list