Thanks
Is it possible that the program is witing for your input?
For example, the code:
spam = input('Enter a line of python code, then press ENTER: ')
print 'Your result is', spam
will print the prompt:
Enter a line of python code, then press ENTER:
and then wait until a return. Whatever the user entered is then run
through the python interpreter, and returned to the variable spam.
Finally, python will kindly print out the result.
--
Sean Blakey
(206)297-7123
quine = ['print "quine =",quine,"; exec(quine[0])"']; exec(quine[0])
[TechSpood]
> ...
> I will write a simple program (in the IDLE enviroment) then
> when I run it, it will run it til it gets to the first input
> statement, at which time it will stop reading the program.
> I don't get a syntax error or any other kind of error.
> ...
Let's track this down. For starters, I'm assuming you also *run* (as well
as write) the program within IDLE. Scream if that's wrong.
You haven't said which version of Python you're using (I assume 1.5.2),
which OS (since your post identified itself as coming from Outlook Express,
I assume some flavor of Windows), or given a minimal failing example. So
there's little to go on. I don't have any problem running this code under
Win95 under IDLE:
for i in range(3):
pw = raw_input(("Please enter your password: ",
"Try again: ",
"Last chance, pal: ")[i])
print "mumble, mumble, ... hey!", pw, "is no good!"
print "Go away."
Do you? Here's a sample session pasted from my IDLE:
Python 1.5.2 (#0, Apr 13 1999, 10:51:12)
[MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
IDLE 0.5 -- press F1 for help
>>>
Please enter your password: xyz
mumble, mumble, ... hey! xyz is no good!
Try again: try what again?
mumble, mumble, ... hey! try what again? is no good!
Last chance, pal: same to you!
mumble, mumble, ... hey! same to you! is no good!
Go away.
Assuming that doesn't work for you, there's one obvious (to me <wink>)
difference in what I'm doing: I'm running the latest version of IDLE, not
the one that shipped with 1.5.2.
If you want to try that, get it from the CVS archive at python.org, or, if
you're not set up for CVS, David Ascher kindly maintains a current snapshot
at
http://starship.python.net:9673/crew/da/
info-is-more-useful-than-frustration<wink>-ly y'rs - tim
This was indeed a bug in IDLE 0.4 as released. In that version, if
you run a script from inside IDLE (by pressing f%), all output goes to
a separate *Output* window. When you use input(), the prompt text is
therefore displayed in that window, but entering text there does
nothing. If you enter text in the *Python Shell* window (where an
innocent Python prompt is displayed) and hit return, that text
actually goes to the program and the program can continue.
It's probably time to make an official release of IDLE 0.5. Maybe
after the conference...
--Guido van Rossum (home page: http://www.python.org/~guido/)
Well, maybe idle doesn't have any STDIN?
What happens if you run your program from a Terminal (Windows people call
it DOS box)?
regards,
Gerrit.
--
Please correct any bad English you encounter in my email message!
-----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com
Version: 3.12
GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE?
Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y
-----END GEEK CODE BLOCK-----