Whenever I try to run a sample code on the GAE via python I get this error
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1665, in LoadModuleRestricted
description)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/cgi.py", line 31, in <module>
import urllib
ImportError: No module named urllib
INFO 2012-04-15 04:44:54,345 dev_appserver.py:2884] "GET / HTTP/1.1" 500 -
I'm not sure what the problem is, and I tried various fixes as in similar questions asked here.
The sample code:
import webapp2
import urllib
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!')
app = webapp2.WSGIApplication([('/', MainPage)],
debug=True)
I'm running on Mac OSX 10.6.8 (Snow Leopard) and using Python 2.7.3