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

Asked

Viewed 3,281 times

3

Using the 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?

3 answers

3

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

3


Probably missed saving the file you are wanting to run.

If this doesn’t solve the problem, try creating a name file __main__.py in the same directory as the program. Inside it, do the import of the file you want to run.

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

import meuscript

0

Save the file with the extension .py before executing it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.