0

I downloaded sublime text 2 and I have a problem running a code with the language python. Here is my code:

def main:
    print "Hello"
main()

I get an error when I do ctrl + B:

[Error 2] The system cannot find the file specified

[cmd: [u'python', u'-u', u'C:\Users\Hari\Documents\test.py']]

[dir: C:\Users\Hari\Documents]

[path: C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon] [Finished]

I am using Windows 8 and I tried to change the environment variables by adding C:\Python27\; or C:\Python26\; or C:\Python33\; or C:\Python2\; or C:\Python2\; to the beginning of the path but it still gives me the same error. Can someone help me?

Simon MᶜKenzie
  • 8,344
  • 13
  • 50
  • 77
asdf
  • 1
  • I dont see your python path at env variable... – papachan May 10 '13 at 01:48
  • [Error 2] The system cannot find the file specified [cmd: [u'python', u'-u', u'C:\\Users\\Hari\\Documents\\test.py']] [dir: C:\Users\Hari\Documents] [path: C:\Python27\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows – asdf May 10 '13 at 01:51
  • The same error pops up again. – asdf May 10 '13 at 01:52
  • See this solution http://stackoverflow.com/a/13111706/403810 – papachan May 10 '13 at 02:21

3 Answers3

2

You need to edit %APPDATA%\Sublime Text 2\Python\Python.sublime-build

Modify (change) content to:

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

So, change the "C:\Python27\" path part to any path/version of Python that exists in your system.

Soft Jr
  • 21
  • 4
0

The easiest way to make sure that changes to environment variables are applied is to reboot Windows.

And if Sublime Text 2 is started from some Python script using subprocess module, then it starts to behave strangely.

iljau
  • 2,151
  • 3
  • 22
  • 45
-1

delete all the paths for python on your system...and try to install python again,I recommend python27. in the environments add c:/python27.

thwildfire
  • 76
  • 9
  • Does sublime text 2 automatically download python27 for me or do i have to do it by myself? Also, how do you delete all the paths for python on the system? – asdf May 10 '13 at 01:58
  • Sublime wont download anything for you so you have to download it by yourself. Yes delete all the python paths on your system and start all over. I use pyDev eclipse plugin its great for python developments I suggest you check it out. – thwildfire May 10 '13 at 02:07
  • 1
    Could you explain a little more, into your choice.. Why you think it's best etc.. As it is, this is suitable for a comment. – Daryl Gill May 10 '13 at 02:11
  • well i just think it makes everything easier when it comes to python. Its my personal favorite anyway – thwildfire May 10 '13 at 02:20