[Tutor] python

alan.gauld@bt.com alan.gauld@bt.com
Thu, 22 Nov 2001 17:20:41 -0000


>   I finally can run python in interactive mode in dos
> from the python21 directory. What other modes are
> there? 

There is 'interpretive mode'(for want of a better term!)
Thats where you run a program written in python under 
the control of the python interpreter. Thus is the file 
is called hello.py you type:

C:> python hello.py

Or from the Start|Run dialog

python hello.py

Or even just

hello.py

Or just double click hello.py in windows explorer

Each of these will start the python interpreter and feed 
it the hello.py file. It will execute the hello.py 
program then exit without going to the >>> prompt 
you have seen so far.


> Do I run them from DOS or from windows? 

Several ways as you can see above.

Mostly you will just double click the file for 
finished programs but during development you 
probably want to use the first option so that 
you can see any error merssages in the DOS box 
after it stops running.

Finally, once you get your program running OK, 
if you don't need a DOS box for user input or 
to display output(say its a GUI app or a pure 
batch processing thing) you can rename the file 
to hello.pyw which starts pythonw.exe instead 
of python.exe. This runs the program without 
starting a DOS box.

HTH,

Alan G.