[Tutor] Running Existing Python

Alan Gauld alan.gauld at btinternet.com
Sat Feb 26 01:46:44 CET 2011


"Justin Bonnell" <jwbonnell5 at gmail.com> wrote

> Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34) 
> [GCC 4.2.1 (Apple Inc. build 5664)] on darwin
> Type "copyright", "credits" or "license()" for more information.
>>>> 

The >>> prompt means you are already inside Python.
You can type Python commands at the >>> prompt, things like

>>> print "Hello"

But you cannot ruin a program from inside the >>> prompt 
(well, you can, but its more complicated than sane people 
want to bother with! :-)

You run a Python script from the OS Terminal prompt:

$ python hello.py

> Shouldn't I be able to run hello.py from the IDLE interpreter?

You can't run it from the >>> prompt in IDLE but....
What you can do is open the file for editing and then 
run that file using the menu commands, then the 
output will show up in the interpreter window.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/





More information about the Tutor mailing list