pythonpycharm

Can't run a Python file in PyCharm: why?


I can't run a Python file in PyCharm: why?

The run icon is greyed out:

The run button is greyed out.

I went to Run → Edit Configurations… to make sure the correct Python interpreter is selected. Debug, coverage, and profile are fine but I don't see run:

Run configuration not present.

Strangely, only run won't run. What's the issue? I use PyCharm 2024.2.3 Pro.


Solution

  • I closed the window containing the PyCharm project and reopened the project: it worked. I have no idea why it didn't work before reopening the PyCharm project. Very strange: I don't see what could cause "Run" to disappear from the option in the run/debug config window. It's back now:

    enter image description here

    Same code, same python interpreter, same pycharm project, same everything as far as I know.