Exit function: How to prevent the error message

Hello All,
I am brand new to Repl.it but not to programming. When I use the exit() function the console has the message:
repl process died unexpectedly:
The message is totally wrong. I can exit for a valid expected reason. That message is very misleading. Please advice how I can avoid or get rid or suppress that erroneous message.
thanks
ananda

The exit() function in Python exits the Python REPL (Read, Eval, Print, Loop). Replit doesn’t expect this to happen, and it could have been caused by some internal error, or in your case because you called exit(). You shouldn’t actually use exit() in your code if possible, and it should only be used for exiting the REPL inside of Shell. Try to let your code end naturally.


Replit is set up in such a way that the Console is viewable at all times. The Console is configured as the Python REPL while your program is not executing. Comparing Replit to running on your local machine, Python would end the process and close the Console window locally, and you wouldn’t see such a thing. But Replit has to continue showing the Console, and this is another reason why such an error message is there. If your program ends abruptly, and you aren’t aware, Replit’s error message shows that there was some termination within your code.

3 Likes

Thanks a lot. The second answer answered my question fully. I tried my program in a command prompt and as you said the error message did not show up. So the error message is exclusively of the Console. Got it!! Will just ignore this and any such console based error messages during development. Thank you for the prompt reply.

2 Likes

@AnandaVardhana If @bobastley 's answer helped you, you can mark that as a solution and close the topic.

2 Likes

Can’t do that in General.

That’s not the entire reason we do it, BTW. We do it so anyone with the same question can know what the answer is without having to scroll through the whole thread.

1 Like

Sorry for not following the procedure. This was my first time. Will keep it in mind in the future. I do see the Solution checked and green now.
Thanks to all

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.