r/pythonhelp • • 3d ago

python breaks for some reason when I rename a project

Hi, python newbie here, and I have a very weird problem which is that whenever I rename a project, python refuses to run it because of "cannot run program "/Users//PycharmProjects/WelcomeScreen/.venv/bin/python" (in directory "/Users//PycharmProjects/Blackjack_but_working"): Exec failed, error: 2 (No such file or directory)"

(i censored my name for privacy reasons but otherwise that is the error)

plz help

3 Upvotes

14 comments sorted by

•

u/AutoModerator 3d ago

To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/atarivcs 3d ago edited 3d ago

How exactly did you rename the project?

Did you right-click the root folder of your project and select Refactor | Rename from the context menu, as Pycharm recommends doing?

Or did you just manually rename the folder?

1

u/Clear-Bad4685 19h ago

I renamed it from the menu

1

u/pretty-weed 1d ago

How did/ do you install your project?

1

u/Clear-Bad4685 19h ago

I made a new folder and imported pygame from the terminal

1

u/codeguru42 1d ago

Looks like you use PyCharm as your editor. Are you also running in pycharm or are you running from command line? I recommend checking the run virtual environment that is setup in pycharm and the run configuration. Be sure that both have the new path after you renamed.

1

u/Clear-Bad4685 19h ago

It has a venv

1

u/codeguru42 14h ago

That's good, but doesn't answer m question

1

u/Available_Safe1818 3d ago

If you type the command 'python' at the prompt will it run the interpreter?

Maybe you need to set up venv somehow.

1

u/Confident_Hyena2506 3d ago

Check how exactly you are running it - it's looking for python in a path that doesn't exist anymore, because you changed it.

1

u/Prosis632 1d ago

Instead of pycharm I would suggest using VS Code. I have been using it for almost 5-6 years and it look a bit scary and complex but trust me just try to use it 1-2. Try to use venv or conda or even conda mini anyone of these three so that you can keep your project and libraries separate.

1

u/pretty-weed 18h ago

How about which -a python3