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

 

21 comments
Comment actions Permalink

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.

3
Comment actions Permalink

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

 

0
Comment actions Permalink

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

1
Comment actions Permalink

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).

0
Comment actions Permalink

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. 

0
Comment actions Permalink

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

 

0
Comment actions Permalink


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

0
Comment actions Permalink

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

1
Comment actions Permalink

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

0
Comment actions Permalink

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

0
Comment actions Permalink

@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).

0
Comment actions Permalink

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

0
Comment actions Permalink

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

Example:

 

0
Comment actions Permalink

How do I do that

 

 

 

 

 

 

0
Comment actions Permalink

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

0
Comment actions Permalink

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).

0
Comment actions Permalink

Thank you so much now it is working.

0

Please sign in to leave a comment.