[Tutor] Capturing user input

D-Man dsh8290@rit.edu
Wed, 20 Jun 2001 13:27:35 -0400


On Wed, Jun 20, 2001 at 04:55:49PM +0100, Adrian at home wrote:
| 
| It works from me when I use the Python shell in IDLE, but if I type it into
| a file "test.py" save and run it F5, I get no output of the variable "name."
| BTW, I am running on WIN ME.  I get no error messages after I press return,
| It seems that it is still capturing user input and not getting to the print
| command.

What happens after you press return?  Does the "DOS" window disappear?
If so, then it printed just fine, Windows just didn't think you wanted
to read it =p.  It is a well known problem with Windows shell support.
There are a couple of solutions :

1)  add an extra  'raw_input()' call to the end of the script, then
    the shell window won't disappear until you press enter (again)

2)  figure out how to tell windows not to close the window when the
    program completes, I don't remember any more (and have yet to find
    it on win2k)

3)  open a shell window manually, then run the script from the command
    line.  The window won't close because the shell is still running
    (you'll get another prompt).  This is what I do.


I just reread your message and saw that you used "F5" in IDLE to run
the script.  I have never used IDLE so I can't help there.  The stuff
I wrote above pertains to double-clicking on the .py file in explorer
to run it so they are irrelevant; the first might actually still be
relevant.  Useful to know anyways.

-D