[Tutor] invalid syntax error in Run Run Module

Lisa Hasler Waters lwaters at flinthill.org
Thu Feb 18 09:10:20 EST 2016


Alan,

Thank you so very much! This worked perfectly!

Now, if you don't mind and you have the time, can you please elaborate on
when we (we being Python novices) would use the *Shell* vs when it is best
to use the *Editor*?

Many, many, many thanks!

Lisa



On Wed, Feb 17, 2016 at 12:43 PM, Alan Gauld <alan.gauld at btinternet.com>
wrote:

> On 17/02/16 15:45, Lisa Hasler Waters wrote:
>
> > -When we try to select Run Run Module - we get the error message "invalid
> > syntax," which points to the number 5 in Python 3.5.1
>
> OK, that probably means you are trying to run the Python shell
> window which is the wrong thing to do.
>
> Run module is for when you create a program in a new edit
> window as a separate file.
>
> Try this set of steps
>
> 1) open IDLE
> a python shell window appears (with >>> prompt)
> 2) File->New File
> 3) Select python script, hit OK - this step is not always needed
> - a new editor window opens (no >>> prompt)
> 4) Type
>
> print("Hello world")
>
> in the editor.
>
> 5) File->SaveAs and choose a name - hello.py, say
> 6) Run->Run Module
>
> You should see Hello world appear in the shell window
> with no errors.
>
> The shell window is for interactively trying out code
> snippets. The editor window(s) are for creating Python
> programs that can be run directly from the OS command
> line (or as icons on your desktop/finder).
>
> HTH
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>



-- 
Lisa Waters, PhD
Technology Integration
Flint Hill School


More information about the Tutor mailing list