I am new to pragramming and also Python. I was reading the intro and basics for beginners in the sticky of this forum and tired it out. It was cool and all but after saving the files, I click F5 to run it and i get the error message :

Syntax Error
There's and error in your program:
invalid syntax

then in highlights in orange the number "4" of 2.4.1 in the top of the IDLE thingy that shows the version "Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information."

Is this an error of my doing or of the program version? Can someone help?
Hope I'm not being too long winded here...sorry if I am.

Recommended Answers

All 7 Replies

When you get a syntax error, it's customary to post the code as well as the error. :rolleyes:

Oh... Eh HeH... :mrgreen: My bad... Like i said, newbie.
umn..it actually happens for all codes. The most basic of which were the first two of which are on vegaseat's Starting Python thread.

>>>print "Hello Monte Python!"

then I press Enter and save it after that as HelloMP.py. After saving if I click to Run after opening the saved filed as "edit with IDLE", or press F5, the error pops-up.

You did the right thing, keep telling me what is going on, and together we can straighten this beginner problem out. You are not only learning to use Python, but also how to use the IDLE IDE properly. The learning curve is a little steep there.

I tried to recreate your problem. There should be no >>> in front of print, >>> is the prompt of the Python Shell, also called the Interactive Window where your program result shows up. I don't know how that ended up in your program code, but please remove it.

Make sure you are in the edit window of IDLE (has no >>> prompt) when you type your code as shown in the Starting Python sticky.

print "Hello Monte Python!"

Then press the F5 key, IDLE might ask you to save the program first, do so. Now your result should come up in the output window, the Python Shell.

Hello there. I am back. Sorry, I couldn't get on anything, had broken my arm. Still in a sling but I can't stand being away from the com. So to gte back to my problem soon. I uninstalled and re-downloaded Python to the latest version. I could not get around to remove the ">>>" from the front. I opened Python IDLE (GUi) and it was always there. Will retry.

Ok i have installed the latest version and open IDLE (Python GUI) and the >>> is still there and I can't remove it. This Python application is the white one not the MS-DOS black one. Maybe thats the problem but when I open that one I can't type in it. Instead with it opens the same Python application with the >>>. Sorry about all this.

For some odd reason your copy of IDLE is configured to start up in the Shell Window rather than the usual Edit Window.

So go to 'Options' on the top line and then click on 'Configure IDLE'. In the configure menu go to the 'General' page and set the 'Open Edit Window' at startup option and click on 'Apply'. That should do it!

Ahh.,..thanks alot mate. :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.