Ask coding questions

← Back to all posts
no such file
wuwls11 (0)

Hey, I am a newbie on this ground.

Recently, I have started making fun and blah blah for 2 days?

But, somehow whatever I try, the console just says no such file: main.py.

So I have tried changing names of files, making another folder for it, but it never works.

Get me a help, plz. ;)

Comments
hotnewtop
Wumi4 (532)

It is because by default, Repl takes the Python file main.py as an entry point. Every time you run a Python Repl, It will run the file main.py.

To fix this, there are 2 ways:

  • Open the Shell tab next to Console tab, then type:
python3 <your_file_here.py>
  • Create a file called .replit, then type in:
run = "python3 <your_file_here.py>"

Note that I can't confirm that the second way will work, so can someone confirm me about the second way?

OldWizard209 (1544)

The second way will always work. No need for the 3 in python 3 if ur repl is of python 3 itself. @Wumi4