Reputation: 31
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!
Upvotes: 3
Views: 13489
Reputation: 7
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
Upvotes: 0
Reputation: 41
You didn't save the file. You need to save the file like name_fila.py then you'll be able to run it
Upvotes: 4
Reputation: 2398
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.
Upvotes: 12
Reputation: 96
i think you should make a __main__
like this __name__ == '__main__'
module then try to compile it ...
Upvotes: -1