[Tutor] how to run a text file in an interpreter?

Tonu Mikk tmikk at umn.edu
Fri Mar 30 19:43:54 CEST 2007

I started reading Instant Python tutorial ( 
http://hetland.org/writing/instant-python.html ) and came across this 
"/Note:/ To get the examples working properly, write the programs in a 
text file and then run that with the interpreter; do /not/ try to run 
them directly in the interactive interpreter - not all of them will work. "

I do not know what the author means by running a text file with the 
interpreter. I noticed that I came across an obstacle early on in trying 
out the code.

I tried writing

|first, second = second, first

into the PythonWin interpreter, but this resulted in the following error after pressing the return key:

Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
NameError: name 'second' is not defined

I imagine that I need to create a text file first and then run it with the interpreter.  How do I do that? 

Thank you,

More information about the Tutor mailing list