Ask coding questions

← Back to all posts
About Renaming main.py?
h
BladeMark (0)

Hey! I have a simple question.

If I rename like main.py to other names, it cannot run, showing "No such file: main.py" and "repl process died unexpectedly: exit status 2" in the console.

How to deal with this? I didn't find the answer in the doc. OMG!

Thanks!

Answered by InvisibleOne (3003) [earned 5 cycles]
View Answer
Comments
hotnewtop
InvisibleOne (3003)

Well repl by defualt looks for a main.py file, to make a different file the entry point you have to create a file named .replit and put this inside it: run = "python3 filename.py" with filename being you filename of course.
Here's a tutorial on .replit files : https://replit.com/talk/learn/Configuring-the-RUN-button-Java-and-Python-Examples/45487?order=votes

notGilbert (121)

Add a .replit file and put:

run="python3 insertFileNameHere.py"

more info - https://docs.replit.com/repls/dot-replit

BladeMark (0)

Thank you guys! ^_^