[Tutor] invalid syntax error in Run Run Module
Alan Gauld
alan.gauld at btinternet.com
Wed Feb 17 12:43:59 EST 2016
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
More information about the Tutor
mailing list