Try to run my code but console just keeps "working" indefinitely without code running

Bug description:
Press run but code doesn’t run in console, just keeps saying “working”

Expected vs Current Behavior:
Expected that code runs and I get readouts in the console.

Steps to reproduce:
Usually the console runs perfectly a couple of times and then just stops working. Need to run the program a few times and eventually it’ll fail. Hard refreshing the page doesn’t fix it.

Bug appears at this link:

Screenshot(s)/Screen Recording:

Browser/OS/Device: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Replit Profile:

the reason is that using exit() in your code can unfortunately cause your next run to be stuck in a Working state. (This is indeed a bug.)

First, you can restart your repl by typing kill 1 in the Shell.

Then, refactor your code to avoid using exit(), the program should only stop by reaching the end of the file.
One easy way to do this is to wrap most of your main code in a main() function, then call it. Then, you can replace all exit() calls with a return inside the main() function.

1 Like

While that’s true, this day in 100 DoC does tell you to use exit IIRC. I think converting it to the Repl template without prybar would resolve this issue.

1 Like

The newer configuration should work fine on these old repls, any pre installed packages for any of the Days should get auto installed. Probably replit.nix can also be deleted, as well as venv and .config.
Is there an easy command for converting?

I think my script should still work for these cases, though it still leaves a dummy replit.nix file.

curl -s|bash -s

(Most other posts that reference my script are on the version, which should still work as well.)

1 Like

This was the code I ran that produced a similar error, no exit() function… any ideas?

from flask import Flask, request

app = Flask(__name__)

@app.route('/process', methods = ["POST"])
def process():
  form = request.form
  if form['yes_no'] == 'Yes' and form['favefood'] == "Robot Food":
    return "You are a robot!"
    return "You are a human"

def index():
  page = ""
  f = open("form.html", "r")
  return page'', port=81)