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,
Zia
Please sign in to leave a comment.
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).
Please see this post for a detailed answer:
https://stackoverflow.com/questions/23441657/pycharm-run-only-part-of-my-python-file
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.
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
Thanks
Zia1 Chowdhury
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 (hi.py) and proceed to run it with the run configuration:
https://www.jetbrains.com/help/pycharm/creating-and-editing-run-debug-configurations.html
Thank You Andrey Resler for your quick response and yeah naming my file as .py helped.
@Pranav10lm
You should specify the full path to hello.py 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.
Example:
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 https://www.jetbrains.com/help/pycharm/creating-and-running-your-first-python-project.html#run
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.