[Tutor] How to run a python script

Chad Perry cperry172 at hotmail.com
Sat Feb 20 19:36:51 EST 2016

What version of Python are you using? Have you tried an

apt-get -y update

yum -y update


Chad Perry
cperry172 at hotmail.com

From: Alan Gauld<mailto:alan.gauld at btinternet.com>
Sent: Saturday, February 20, 2016 6:32 PM
To: tutor at python.org<mailto:tutor at python.org>
Subject: Re: [Tutor] How to run a python script

On 20/02/16 16:25, Erol Gericke wrote:

> However I am unable to run any scripts.
> When I type (into the COMMAND PROMPT window) python test.py or
> python C:\python27\test.py      I get SyntaxError: invalid syntax

As Chris has hinted it sounds like you are running the script
at the wrong command prompt.

In general the Python prompt >>> is used to enter code
snippets directly.

The OS command prompt (C:\Windows> or similar) is used
to run Python script files.

To get an OS command prompt hit WindowsKey->Run and
type CMD and click OK. (You can also create a desktop
shortcut if you prefer.)

Also, for future reference it will help if you send
(cut n paste) the full error message not just a summary.
It contains a lot of useful data that helps pinpoint
the issue, once you learn to read it.

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:

More information about the Tutor mailing list