Sublime Text 2 - error message in python / usr / bin / python: can not find '__main__' module in ''

2

Using cmd+B (Tools -> Build) in Sublime Text 2, the following error message appears:

/usr/bin/python: can't find '__main__' module in ''

How to solve this?

    
asked by anonymous 05.03.2014 / 04:32

2 answers

3

You probably missed saving the file you are trying to run.

If this does not resolve the problem, try creating a file named __main__.py in the same program directory. Within it, import of the file you want to run.

Ex: Assuming that the program you want to run is in the meuscript.py file, the contents of __main.py__ would look like this:

import meuscript

    
05.03.2014 / 11:03
3

In general this problem can be solved by saving the script before running it.

    
05.03.2014 / 04:38