My python program has two raw_input() calls
The first raw_input() should accept multi-line input from the user. The user can issue Ctrl + D (Ctrl + Z in the windows) to end the input.
The second raw_input() should take another input from the user with a request of type (y / n).
Unfortunately (on Mac OS X only?), The second raw_input() raises an EOFError when stdin completes (with Ctrl + D) first raw_input() .
See my sample code below for more details -
mailBody = '' signature = 'Later!' print 'Compose your mail:' while True: try:
Program Output:
-1- abhinay@MacBook code/py % python prompt.py Compose your mail: hello there! how is everybody? Do you want to add signature to your mail? (y/N): Traceback (most recent call last): File "prompt.py", line 11, in <module> opt = raw_input("Do you want to add signature to your mail? (y/N): ").lower() EOFError
How to make a second prompt not to raise an EOFError . Please, help!
EDIT:
I edited my question to make things simple.
I ran my code above on the Linux System, it works without any problems. That is, the user was asked to make a second selection of raw_input () to select "(y / N)".
abhiomkar
source share