Simple Python Repl with a single ‘print’ statement fails to deploy with an ‘exec [python3 main.py] error=exec: already started’ error

Question:
Why am I encountering this error whenever I attempt to deploy any Python script? For the sake of troubleshooting, I’ve created a new single-line ‘Hello world!’ project which still fails to deploy when I try it. I’m using the default ‘python3 main.py’ run command with no other deployment parameters:

2024-02-14T19:13:10Z info: Creating Autoscale service
Hello world!
exec [python3 main.py] error=exec: already started
starting up user application
2024-02-14T19:13:26Z error: The deployment failed to initialize due to a configuration or code error. Check the logs tab for more information. For additional support, please post on https://ask.replit.com/c/help/13 and a staff member will take a look.

Repl link/Link to where the bug appears:
https://replit.com/@theMysteriousCat/HelloWorld#main.py

Screenshots, links, or other helpful context:
Log:

02/14/24 07:34:00 PM exec [python3 main.py] error=exec: already started
02/14/24 07:34:00 PM Hello world!
02/14/24 07:33:59 PM starting up user application
print("Hello world!")

Why do you want to deploy a single print statement?

Just for testing purposed because I haven’t been able to deploy anything in Python.

I created the simple “Hello world” project in order to eliminate as many variables as possible when debugging why Python deployment doesn’t work for me.

It appears that you are deploying the repl as Autoscale, which is for web servers. Instead, deploy your repl as Reserved VM > Background worker.

Okay. Does that mean that for non-web applications I can’t take advantage of usage-based billing and need to pay a fixed monthly fee for a VM? And if so, does that mean that I can only have one Repl deployed at a time?

No, you can upgrade your VM specs when deploying your Reserved VM.

No, you can have multiple repls deployed at a time.

I’ve been waiting for 7 minutes for deployment of “Hello World!” as a Reserved VM, but it appears to be caught in a loop with exec:

2024-02-14T19:46:44Z info: Created Repl layer
2024-02-14T19:46:44Z info: Created hosting layer
2024-02-14T19:46:44Z info: Pushed image manifest
2024-02-14T19:46:45Z info: Pushed soci index manifest
2024-02-14T19:48:51Z info: Creating virtual machine
2024-02-14T19:49:17Z info: Virtual machine created
2024-02-14T19:49:17Z info: Waiting for deployment to be ready
exec [python3 main.py] error=exec: already started
starting up user application
exec [python3 main.py] error=exec: already started
starting up user application
starting up user application
Hello world!
exec [python3 main.py] error=exec: already started
Hello world!
starting up user application
exec [python3 main.py] error=exec: already started
starting up user application
exec [python3 main.py] error=exec: already started
exec [python3 main.py] error=exec: already started
Hello world!
starting up user application
Hello world!
Hello world!
starting up user application
exec [python3 main.py] error=exec: already started
starting up user application
Hello world!
starting up user application
exec [python3 main.py] error=exec: already started
starting up user application
Hello world!
starting up user application
exec [python3 main.py] error=exec: already started
starting up user application
exec [python3 main.py] error=exec: already started
Hello world!
starting up user application
Hello world!
starting up user application
exec [python3 main.py] error=exec: already started
Hello world!
starting up user application
exec [python3 main.py] error=exec: already started

I got a “Your app failed to promote” error right after that log. Not sure what the problem is - I’ve created the simplest imaginable Python script and I’m using the default deployment parameters.

I’ve encountered the same behaviour both on Firefox ( 122.0.1 ) and Chrome ( 121.0.6167.184 ) on my Win11 machine ( 23H2 ), in case that matters.

I’d almost say Replit is assuming your script crashed because of how fast it’s exiting.

Deployments have to loop forever. So you could do something like this:

while 1:
   print("Hello world!")
3 Likes

It sounds like we could use some deployment examples/templates. I’ll file this request for the team and maybe we can include something in our documentation for the different deployment types.

5 Likes