Skip to content
← Back to Community
About Renaming main.py?
Profile icon
h
has Hacker Plan
ChaosSpark

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 [earned 5 cycles]
View Answer
Comments
hotnewtop
Profile icon
InvisibleOne

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

Profile icon
ch1ck3n

@InvisibleOne dang you beat me to it

Profile icon
InvisibleOne
Profile icon
InvisibleOne

@ch1ck3n
unnamed-2

Profile icon
ch1ck3n
Profile icon
JWZ6
Profile icon
ch1ck3n
Profile icon
notGilbert

Add a .replit file and put:

run="python3 insertFileNameHere.py"

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

Profile icon
JWZ6

YAYYYYYYY

Profile icon
ChaosSpark

Thank you guys! ^_^