[Tutor] Python trouble

Steve Willoughby steve at alchemy.com
Sat Apr 23 01:01:13 CEST 2011


On 22-Apr-11 11:52, Alex Butler wrote:
> Ok let me try to be more clear. I am trying to write code in the IDLE
> Python GUI of python 2.7. When I open the new python shell, there is a
> written header as well as the three >s on the left side. I now those are
> used as indents and I do not type them in. However, whenever I write any
> type of code and either attempt to run or click alt + x to check module,
> it says “there is an error in your program: invalid syntax.” Then when
> it goes back to the page to highlight the syntax error the second > is
> highlighted in color as it is the problem. Before I deleted the header
> from this program, it would highlight the 7 after the 2. In the header.

Okay, that's pretty much what you said last time.  What is the actual 
code you're trying to run?


If it's really complaining about >>> being a syntax error, it sounds 
like you're confused about where you are in the tool or extra text is 
getting pasted.

If you open a new source window (file->new) (not a "shell" window), and 
type some python code, that window won't have a header line or >>> 
prompts at all, just your code.

So...

start IDLE

select File->New; new untitled window pops up

type a python program, maybe this:

      print "hello"

hit alt-X (although personally, I'd hit F5 instead).
It should prompt you for a file to save your new program into, then run 
it back in the other window (the shell) that has the >>>s in it.

How, exactly, does what I just described differ from what happened to you?


-- 
Steve Willoughby / steve at alchemy.com
"A ship in harbor is safe, but that is not what ships are built for."
PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C


More information about the Tutor mailing list