sublime text2 python error message /usr/bin/python: cant find __main__ module in
sublime text2 python error message /usr/bin/python: cant find __main__ module in
I got the same error as I didnt save the script before executing it. Check to see if you have saved it!
Note to anyone else:
If you have a directory like so, you can add a __main__.py
file to tell the interpreter what to execute if you call the module directly.
my_module
|
| __init__.py
| my_cool_file.py # print Hello World
| __main__.py # import my_cool_file
$ python my_module # Hello World
sublime text2 python error message /usr/bin/python: cant find __main__ module in
You need to SAVE your code file with the .py extension. Then, on the Tools/Build System menu, make sure your build system is set to either auto or Python. What that message is telling you is there is no valid Python file to build (or, in this case just run).