[Tutor] running a script from IDLE

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Thu, 7 Mar 2002 10:09:43 -0800 (PST)


On Thu, 7 Mar 2002, Ron Nixon wrote:

> I've been toying around with IDLE in the interactive mode, but I can't
> seem to figure out how to run a script from IDLE that I've saved. When
> I copy to file into IDLE and hit "run script" I get a messege saying
> "The buffer for Python Shell is not saved. Please save it first." If I
> save the file to a directory, open it in IDLE and then chose "run
> script" I get an invalid syntax error.

Hi Ron,

Hmmm... can you show us the SyntaxError?  Without seeing more detail, I'm
going to have to guess.  *grin*


My best guess at the moment is that there may be '>>> ' prompts accidently
copied over when saving that file.

If so, try stripping them out of your saved file.  These '>>>' prompts are
used by the interactive interpreter to show when it's ok to type, but
they're not actually real "Python" code.


If you have time, you may want to look at my IDLE tutorial:

    http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro

Best of wishes to you!