[an error occurred while processing this directive]

Using Python in Lab

The suggested IDE (Integrated Development Environment) for using Python in ITC labs is called IDLE, and it is actually written in Python. (The name is supposedly an acronym for Integrated DeveLopment Environment, but is more likely a reference to Eric Idle.

To run IDLE in the labs, go to Start->Run... and type in (or browse to):
   C:\Python21\Tools\idle\idle.pyw

This will open a window named *Python Shell*. Inside this window you can see the Python prompt. Here, you can type interactive Python code and have it execute immediately. Go ahead and try it. Type 4+4 and hit enter. You should see:

>>> 4+4
8
You can type in arbitrary Python code at this command line. Try the below:
>>> for i in range(1,4): print i
1
2
3
Note that the keywords are highlighted as you type, and when you type "range(" simple usage information about the range function appears. However, you shouldn't do the problem set typing code in at the command line — you might have already realized this if you made any mistakes typing any of the above. Instead, you should use IDLE's built-in text editor, which also does syntax highlighting and function definitions.

To do this, in IDLE, click on File->New Window. In this window, enter:

for i in "alphabet":
    print i
Now, save this script (click File->Save as...) and name it whatever you want. Now, click on Edit->Run Script. The output of this script will appear in the *Python Shell* window.

To start working on PS1, go to PS1 and click the ps1.zip download link. Unzip it into J:\cs216\ps1 (or any directory you have access to).

Now, in IDLE, click File->Open... and navigate to your newly unzipped TimerExample.py. Uncomment the lines at the top of this file and change the path to match your working path (if necessary):

import sys
sys.path.append('J:\\cs216\\ps1')
Now, in the window where you typed the script, click on Edit->Run Script.

[an error occurred while processing this directive]