[Tutor] Running Existing Python

Corey Richardson kb1pkl at aim.com
Sat Feb 26 00:51:08 CET 2011


On 02/25/2011 06:42 PM, Justin Bonnell wrote:
> I downloaded Python 2.7.1. I think this is a pretty basic question.
> When I try to run the existing python files on the computer (hello.py), I receive a syntax error. 
> 
> 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.
>>>> python hello.py
> SyntaxError: invalid syntax
> 
> I am running Mac OS X version 10.6.6.
> Shouldn't I be able to run hello.py from the IDLE interpreter?

You need to run "python hello.py" in a terminal window, not from the
Python interpreter. If you are using IDLE, you can File > Open hello.py
and hit F5 to run it... I don't know if that advice applies to Mac,
might be different key strokes.

-- 
Corey Richardson


More information about the Tutor mailing list