I am a beginner to Python and am having great difficulty in running my python googleppengine code locally on my machine.
My code looks as follows:
import json
import urllib
import os
import webapp2
from google.appengine.ext.webapp import template
import datetime
from google.appengine.ext import db
class Events(db.Model):
venue_name = db.StringProperty()
address = db.StringProperty()
id = db.StringProperty()
venue_id = db.StringProperty()
# hire_date = db.DateProperty()
# attended_hr_training = db.BooleanProperty()
class eventSearch(webapp2.RequestHandler):
def get(self):
base_url = 'http://api.eventful.com/json/events/search?app_key=zGtDX6cwQjCRdkf6&l=dublin&?q=music'
response = urllib.urlopen(base_url)
html = response.read()
html = json.loads(html)
result = html['venues']
result1 = result['venue']
When I run this code in my cmd prompt with command "python file.py", I receive the following error:
Traceback <most recent call last>:
File "file.py", line 4, in <module>
import webapp2
ImportError: No module named 'webapp2'
I have 1. Created a PythonPath as suggested in How to add to the pythonpath in Windows? within my system variables with directories: C:\Python33\DLLs;C:\Python33\Lib;C:\Python33\Lib\lib2to3;C:\Program Files (x86)\Google\google_appengine;C:\Program Files (x86)\Google\google_appengine\lib;
I have then also added both of the below directories into my "PATH" variable also, as recommended within answer - import webapp2 works on google-app-engine even though I don't have webapp2 installed
C:\Program Files (x86)\Google\google_appengine\;C:\Program Files (x86)\Google\google_appengine\lib
EDIT: After suggestions within the answers provided I too have realized that GAE does not support version 3.3 of Python I was trying to run it with in my previous part of my question. After uninstalling Python33 and installing Python27 instead, changing my system variables to reflect the new Python27, I am still having issues and my code will not upload with the GAE launcher. I receive the following errors within my log-console (GAE Launcher):
2013-04-14 22:59:19 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8001', 'C:\\Users\\Karen\\Desktop\\Development\\projects\\file']"
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 193, in <module>
_run_file(__file__, globals())
File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 189, in _run_file
execfile(script_path, globals_)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 30, in <module>
from google.appengine.datastore import datastore_stub_util
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastore\datastore_stub_util.py", line 45, in <module>
from google.appengine.api import api_base_pb
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\api_base_pb.py", line 20, in <module>
from google.net.proto import ProtocolBuffer
File "C:\Program Files (x86)\Google\google_appengine\google\net\proto\ProtocolBuffer.py", line 22, in <module>
import httplib
File "C:\Python27\lib\httplib.py", line 71, in <module>
import socket
File "C:\Python27\lib\socket.py", line 47, in <module>
import _socket
ImportError: Module use of python25.dll conflicts with this version of Python.
2013-04-14 22:59:21 (Process exited with code 1)
Thank you for any help that you can provide me.