Exit() not working properly in Python

Problem description:
When using exit() using the Python Beta template, I get an error and the Repl does not stop.

Expected behavior:

repl process died unexpectedly

Actual behavior:
The output flickers and then gives me an error. The Repl also does not stop running. Sometimes it flickers much longer than in this video.

repl process died unexpectedly: 

Giving up. You can try again by clicking Run. You may need to fix the [interpreter] definition in the .replit file first.

Steps to reproduce:
Make a Python Repl using the Python Beta and use the exit() function.

Bug appears at this link:
https://replit.com/@CoderElijah/UnwelcomeUnhappyBases (did not happen on cover page but only in the workspace)

Browser: Firefox
OS: Arch Linux
Device (Android, iOS, n/a leave blank): HP EliteDesk G2 SFF
Plan (Free, Hacker, Pro Plan): Hacker

BTW I know that the commented code is an atrocity. I designed it that way. :grin:

2 Likes

CPU was too high. You can see in the recording that the cpu bar was on fire so that might fix the issue. Hope that helps! (Maybe you need to computer too cool down or close stuff running in background

I have never seen that cause this issue on any Repls in any languages before.

That is irrelevant as Replit is running the code on their server, not my computer.

3 Likes

Oh sorry about that,

1 Like

Raising a SystemExit error in python in replit has always acted weird.
What’s probably happening is that the prybar interpreter doesn’t expect the python interpreter to shut down (which SystemExit causes) without an exception or end of program, it sees that it “died unexpectedly”. So it reruns the repl again and again, maxing out CPU and causing the console output to “flicker” and then prybar gives up.

btw, it’s better to use sys.exit() instead of exit() in your python programs

2 Likes

Interesting. What’s weird though is that it works on the old Python template (just gives the died unexpectedly error without all that other stuff).

1 Like

I think I remember that. There, probably prybar gives up immediately instead of trying again so it isn’t as much of a problem.

1 Like