My code that used to work no longer works

Why is my code not working? I didn’t change anything.

I’ll try to include as much info as possible

The error is "/nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/bin/python3: can't open file '/home/runner/Practice/main.py': [Errno 2] No such file or directory"

I don’t know how to link to the code so I’m going to copy and paste it below.

Nothing is indented.

a = 10
b = 20
a = 20
b = 10
print("a=")
print(a)
print("b=")
print(b)

Hey @concerro!
This error shows up as the main.py file doesn’t exist.

To solve this, just click the next to “Files” then click “Show hidden files”. Next click on the .replit file and finally you can change the entrypoint to whatever file you want to run.

Images

Dots

Show hidden files

edited

You should also see the docs on how to configure a Repl: https://docs.replit.com/programming-ide/configuring-repl

And if you want to run the last edited file, take a look at this post:

3 Likes

Hey @concerro welcome to the forums!

It seems your File (main.py) is in a Folder. Normally Replit can’t do that and an easy fix is to take it out of the folder.

Another way to fix this is by changing the .replit file. To access it click the three dots next to the left sidebar that says Files >, now click Show Hidden Files a .replit file while appear click on that. Now go to where it says entrypoint = change the directory to your file path in your case make it entrypoint = “Practice/main.py” or for future reference entrypoint = “folder/file.extension”. I hope this helps!

5 Likes

Thanks. Everything is working again. I’ll try the script suggested by NateDhaliwal when I get more confidence and skill.

For now I’ll just make sure the entrypoint is designated for a specific file.

1 Like

Hi @concerro !
Please mark the post that helped you most as the Solution.
Thanks!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.