3

I am unable to get a Python system to build on a friend's computer which runs Windows XP SP3 using Sublime Text 2. We reinstalled Python 2.7.3 and also Sublime Text 2 and still are having trouble with this. Our Python.sublime-build field says:

{
    "cmd": ["C:\\Python27\\python.exe", "-u", "$(FULL_CURRENT_PATH)"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}

When we try to build simple Python programs, such as:

2 * 2

Sublime Text will not build the system, and will instead spit out:

C:\Python27\python.exe: can't find '__main__' module in ''
[Finished in 0.1s with exit code 1]

It would be wonderful if I could get some help with this. Thank you so much whoever assists me with this!

2
  • add if __name__ == '__main__': print 2*2 Commented Feb 23, 2013 at 0:39
  • So do you have a __main__ module? Commented Feb 23, 2013 at 0:53

4 Answers 4

12

I fixed this by saving my file as a .py file. I opened up a new file, added some code, and tried to build it, which gave me that error. After saving as a .py file, I was able to build and run fine.

Sign up to request clarification or add additional context in comments.

Comments

4

You didn't save the file. You need to save the file like name_fila.py then you'll be able to run it

Comments

0

I used this for Python 3.4 and it works pretty good

The current path you put seems to be the issue.

"$(FULL_CURRENT_PATH)" --> "$file"

{ "cmd": ["C:\\Python34\\python.exe", "-u", "$file"], "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.python" }

Alexandre

Comments

-1

i think you should make a __main__ like this __name__ == '__main__' module then try to compile it ...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.