Why when I write code it gives me error and says no file called main.py and if I rename it the code runs?

i am not able to write code in new repls
helpp me plss

Replit Profile: https://replit.com/@pragya1bhandari

Hello pragya,
The issue is that in poetry and pyproject look for main.py to run code, and since it doesnt exist, doesnt run the code which crashed the repl. You, to fix this, would have to rename calculator.py back to main.py.

Edit: Im wrong about poetry but in pyproject I believe the code tries to run main.py. Im going off the error message not the actual code.

Hello, your python repl has an “entrypoint” which defaults to main.py, which means you must have a main.py file to run your code.
If you want to rename the file to something else, then you can change the entrypoint like this:
Click three dots near files and then click Show hidden files. Then, open the .replit file (not replit.nix), and change the entrypoint variable.


@pragya1bhandari In the Shell, you can also enter python calculator.py which runs calculator.py on the Shell. It’s easier because you don’t need to edit any files, and it’s easier to view your Output ‘n’ stuff instead of the new Console.

1 Like