Search code examples
pythonpycharm

Pycharm gets error "can't find '__main__' module"


Whenever I try to run script via Virtualenv in pycharm, i get this error:

C:\Users\Costello\PycharmProjects\test\venv\Scripts\python.exe C:/Users/Costello/PycharmProjects/test
C:\Users\Costello\PycharmProjects\test\venv\Scripts\python.exe: can't find '__main__' module in 'C:/Users/Costello/PycharmProjects/test'

Everything works fine via idle, or vs code. I figure it must be something with a way that I have setup my pycharm but have no idea what.

edit: this happens whatever I run, even simple print function.

edit: even with choosing regular python intepreteur, same happens just in pycharm

C:\Users\Costello\AppData\Local\Programs\Python\Python37\python.exe: can't find '__main__' module in 'C:/Users/Costello/PycharmProjects/test'

Solution

  • Figured out whats wrong. In the configuration window in pycharm, I had to select proper script path:

    enter image description here