Main      Site Guide    
Message Forum
Re: Python Question
Posted By: Sam, on host 24.61.194.240
Date: Friday, June 14, 2002, at 17:46:38
In Reply To: Python Question posted by ang on Friday, June 14, 2002, at 12:52:45:

> I'm just getting started learning python but when I try to 'Run Script' (from the Edit menu) I get an error message "The buffer for Python Shell is not saved. Please save it first!" I get this after I've: opened a new window, typed 4 command lines *exactly* like they are in the tutorial and saved it. I can't find anything on the tutorial site that says anything about this.

I downloaded the Python for Windows package and fired up IDLE to see what the situation was. It seems like an odd way for them to do things. Anyway, I got the error message you did if I didn't save ahead of time. But I managed to make something work. I don't know exactly what you did, so here is exactly what I did:

1. Started up IDLE.
2. Selected File/New Window.
3. In this second window, typed in this one-line program:

print "Hello, World!"

4. Still in the second window, did File/Save, giving it the filename of test.py.
5. Still in the second window, did Edit/Run Script.
6. Back in the first window, the results were displayed.

What you probably did was do the Edit/Run Script from the *first* window, which does indeed give me that error message.

I think the idea is that you use the second window to edit and run your program, and you use the first window to receive the output from your programs as well as to enter in any direct lines of code that you want to execute immediately. For example, you could type...

print "Hello, world!"

...directly in the first window (with the >>> prompt) and it would run as soon as you hit return.

Replies To This Message

Post a Reply

RinkChat Username:
Password:
Email: (optional)
Subject:
Message:
Link URL: (optional)
Link Title: (optional)

Make sure you read our message forum policy before posting.