0

This is my first time trying to link python and sublime text 2, my code is correct and runs easily through the python console but when I try to run it through sublime text I recieve an Error

[Error 2] The system cannot find the file specified
[cmd:  [u'python', u'-u', u'C:\\Users\\Ben\\Desktop\\Api project\\api.py']]
[dir:  C:\Users\Ben\Desktop\Api project]
[path: C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA      Corporation\PhysX\Common;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 (x86)\GNU\GnuPG\pub;C:\Program Files\MiKTeX 2.9\miktex\bin\x64\]
[Finished]

I believe I have not set up python correctly but any suggestions would be hugely appreciated. Also code is as follows

import urllib2
import json

locu_api = 'myapikey'

url = 'https://api.locu.com/v1_0/venue/search/?locality=New%20York&category=restaurant&api_key=myapikey'
json_obj = urllib2.urlopen(url) #Json data (displays the pulled url data)

data = json.load(json_obj)

print data
2
  • 1
    'C:\\Users\\Ben\\Desktop\\Api project\\api.py' the space between Api and project maybe causes the problem Commented Mar 3, 2015 at 8:54
  • stackoverflow.com/questions/17536094/… Commented Mar 3, 2015 at 8:58

1 Answer 1

0

After hashing it out, it appeared I hadn’t added the python directory to my system path’s environement, with that being resolved it all now works as hoped. Control Panel> System and Security > System > Advanced System Settings> in the advanced tab go to Environment Variables. In the environment variables in the System Variables area scroll down until you find Path. Select it and press Edit. Adding in the desired path C:\Python27

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.