1

I am calling a method in python recursively where, by default, a raw_input() is shown. Then if I receive a message I want to have the raw_input() shown again - but currently this only occurs AFTER I press the ENTER Key.

Is there a way of forcing the ENTER key to be pressed by the script after receiving a message?

Note: there isn't anything wrong with my recursion as once I press ENTER the raw_input() is shown

Joel Biffin
  • 348
  • 1
  • 6
  • 18
  • 4
    Can you please update your question with the code, it will be much easier for us to understand why this is happening if we can see it. – roganjosh May 02 '17 at 11:58
  • 1
    Then why do you have `raw_input()` inside the recursive function, if you only need it once? – ishaan May 02 '17 at 12:01
  • 2
    It's not clear what you're doing. You _do_ understand that `raw_input` **always** waits for the user to press Enter, right? – PM 2Ring May 02 '17 at 12:02
  • `raw_input` is a function which waits for enter to be pressed – WhatsThePoint May 02 '17 at 12:23
  • After the user receives a message, or sends a message (using raw_input) I need to call raw_input again – Joel Biffin May 02 '17 at 12:28
  • You mean just like a chatroom?Then you can‘t use `raw_input`, it will block, this may help you [raw-input-and-timeout](http://stackoverflow.com/questions/3471461/raw-input-and-timeout) – Cheney May 02 '17 at 12:42
  • @JoelBiffin, what is your exact input length? – Prabhakar May 02 '17 at 12:44

0 Answers0