Error message "can't find '__main__' module in 'I:/ADDONS/USEEIO/BETA' "

Hello Good people,

I recently installed the pycharm and working on a python project. However, I can't execute anything in the code editor. the error massage says "can't find '__main__' module in 'I:/ADDONS/USEEIO/BETA' "


and the following illustrates the configuration

I was wondering if anyone could help me in this regards.

Warm regards,




Hi Zia,

Is BETA a directory or a file? I'm asking because python files usually have .py extension, but your script path is pointing to BETA. Please ensure that script path in your run configuration is pointing to the correct python file.


Hey Andrey,

I am glad you replied. Yep, its a directory. my project has a number of script files (Python). Which one should I select? Is there any common thing that I can select for the project as a whole. Also, I selected a python file as a script path & hit the run button. It executed without error. Thank you



Ok, glad that it's working. Please note that If you want to run multiple files, you should create separate configuration for each one.


Hey Andery,
Thank you so much for your help. I have another issue. I wanted to know if there is an option to see/get the results from running a chunk of code in editor (similar to Rstudio where the output can be been in a separate window).


I was encountering the same issue. but I thought it had to do with the System interpreter. Thank you so much Andrey for answering his question and thank you Zia1 for posting your question, I would not have known to fix it from there if it wasn't for your pictures. 

Permanently deleted user

Thanks a lot bro. I was encountering the same problem since a month so I decided to work with other interpreters 

all of a sudden I found your solution and I gave a try for it really it worked and helped me a lot to get out of new interpreters 



Zia1 Chowdhury



Hello, I am a total beginner and the online course trainer is teaching me using pycharm and i'm encountering the same problem. Can someone explain me in detail what are the changes i should do. I couldn't quite understand the things written above.

the image of error i'm getting, and also tell me what directory or file should i select from the above images to make it work properly..



P.S. I've did trail and error on every python file in scripts folder. Also uninstalled and reinstalled  python  to and Pycharm a couple of times. Nothing seems to work


Thank You


Well, the first thing you should to is to name the file containing your code with .py extension ( and proceed to run it with the run configuration:


Thank You Andrey Resler for your quick response and yeah naming my file as .py helped.


I have tried everything but can't seem to figure this out. Unistalled and reinstalled a couple of timesPlease help me find a solution



You should specify the full path to script, not just a folder.
The easiest way to run the script is to right-click it and choose Run... (or do it with a shortcut).


I still dont get it. And I am only running one file. So why does it say the_main_ thing


The Script path in your run configuration is incorrect. You should use the path to a file you want to run.




How do I do that








Thats the file I attached it to, the PyCharmCE2019.1 file, but it still doesnt't work.


It's not the file, it's a folder.

See an example of running a file in PyCharm

As mentioned earlier, the easiest way to run the script is to right-click it and choose Run... (or do it with a shortcut).


Thank you so much now it is working.


Please sign in to leave a comment.