ValueError: RSA key format is not supported - python

trying to use big query on google app engine python. I am trying to achieve this using a this client library . I have imported every necessary library and somehow running the snippet below
from bigquery import get_client
# BigQuery project id as listed in the Google Developers Console.
project_id = 'project_id'
# Service account email address as listed in the Google Developers Console.
service_account = 'my_id_123#developer.gserviceaccount.com'
# PKCS12 or PEM key provided by Google.
key = 'key.pem'
client = get_client(project_id, service_account=service_account,
private_key_file=key, readonly=True)
and still get the error:
2015-10-26 19:08:37 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=19090', '--admin_port=9010', 'C:\\Users\\CrowdStar\\workspace\\AppEngineThinkStudio\\TrafficTestCase']"
INFO 2015-10-26 19:08:39,540 devappserver2.py:726] Skipping SDK update check.
INFO 2015-10-26 19:08:39,634 api_server.py:172] Starting API server at: http://localhost:61626
INFO 2015-10-26 19:08:39,634 dispatcher.py:186] Starting module "default" running at: http://localhost:19090
INFO 2015-10-26 19:08:39,651 admin_server.py:118] Starting admin server at: http://localhost:9010
INFO 2015-10-26 18:08:44,361 discovery.py:240] URL being requested: GET https://www.googleapis.com/discovery/v1/apis/bigquery/v2/rest?userIp=%3A%3A1
INFO 2015-10-26 18:08:44,361 client.py:563] Attempting refresh to obtain initial access_token
ERROR 2015-10-26 18:08:44,365 webapp2.py:1528] RSA key format is not supported
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1077, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\main.py", line 72, in get
private_key_file=key, readonly=True)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\bigquery\client.py", line 83, in get_client
readonly=readonly)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\bigquery\client.py", line 101, in _get_bq_service
service = build('bigquery', 'v2', http=http)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\util.py", line 142, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\googleapiclient\discovery.py", line 196, in build
cache)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\googleapiclient\discovery.py", line 242, in _retrieve_discovery_doc
resp, content = http.request(actual_url)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 565, in new_request
self._refresh(request_orig)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 835, in _refresh
self._do_refresh_request(http_request)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 862, in _do_refresh_request
body = self._generate_refresh_request_body()
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 1541, in _generate_refresh_request_body
assertion = self._generate_assertion()
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 1670, in _generate_assertion
private_key, self.private_key_password), payload)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\_pycrypto_crypt.py", line 121, in from_string
pkey = RSA.importKey(parsed_pem_key)
File "C:\Python27\lib\site-packages\pycrypto-2.6.1-py2.7-win32.egg\Crypto\PublicKey\RSA.py", line 665, in importKey
return self._importKeyDER(der)
File "C:\Python27\lib\site-packages\pycrypto-2.6.1-py2.7-win32.egg\Crypto\PublicKey\RSA.py", line 588, in _importKeyDER
raise ValueError("RSA key format is not supported")
ValueError: RSA key format is not supported
ERROR 2015-10-26 18:08:44,372 wsgi.py:279]
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 267, in Handle
result = handler(dict(self._environ), self._StartResponse)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1519, in __call__
response = self._internal_error(e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 1077, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.3\webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\main.py", line 72, in get
private_key_file=key, readonly=True)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\bigquery\client.py", line 83, in get_client
readonly=readonly)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\bigquery\client.py", line 101, in _get_bq_service
service = build('bigquery', 'v2', http=http)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\util.py", line 142, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\googleapiclient\discovery.py", line 196, in build
cache)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\googleapiclient\discovery.py", line 242, in _retrieve_discovery_doc
resp, content = http.request(actual_url)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 565, in new_request
self._refresh(request_orig)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 835, in _refresh
self._do_refresh_request(http_request)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 862, in _do_refresh_request
body = self._generate_refresh_request_body()
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 1541, in _generate_refresh_request_body
assertion = self._generate_assertion()
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\client.py", line 1670, in _generate_assertion
private_key, self.private_key_password), payload)
File "C:\Users\CrowdStar\workspace\AppEngineThinkStudio\TrafficTestCase\oauth2client\_pycrypto_crypt.py", line 121, in from_string
pkey = RSA.importKey(parsed_pem_key)
File "C:\Python27\lib\site-packages\pycrypto-2.6.1-py2.7-win32.egg\Crypto\PublicKey\RSA.py", line 665, in importKey
return self._importKeyDER(der)
File "C:\Python27\lib\site-packages\pycrypto-2.6.1-py2.7-win32.egg\Crypto\PublicKey\RSA.py", line 588, in _importKeyDER
raise ValueError("RSA key format is not supported")
ValueError: RSA key format is not supported
INFO 2015-10-26 19:08:44,404 module.py:737] default: "GET / HTTP/1.1" 500 -

Related

CryptoUnavailableError: No crypto library available

I'm trying to run an application for AppEngine with python where I'm import the example module to get data from Google Analytics https://developers.google.com/analytics/devguides/reporting/core/v3/quickstart/service-py but when I run the server with dev_appserver.py and go to localhost:8080/ I recive an 505 error with his error in the console:
Traceback (most recent call last):
File "/home/ingdavid/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/home/ingdavid/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/home/ingdavid/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/home/ingdavid/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/home/ingdavid/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/home/ingdavid/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/var/www/repositorios/PYTHON/dashboard/app.py", line 248, in get
print analyticsH.main()
File "/var/www/repositorios/PYTHON/dashboard/analyticsH.py", line 111, in main
service_account_email)
File "/var/www/repositorios/PYTHON/dashboard/analyticsH.py", line 35, in get_service
scope=scope)
File "/var/www/repositorios/PYTHON/dashboard/oauth2client/util.py", line 137, in positional_wrapper
return wrapped(*args, **kwargs)
File "/var/www/repositorios/PYTHON/dashboard/oauth2client/client.py", line 1503, in __init__ _RequireCryptoOrDie()
File "/var/www/repositorios/PYTHON/dashboard/oauth2client/client.py", line 1457, in _RequireCryptoOrDie
raise CryptoUnavailableError('No crypto library available')
CryptoUnavailableError: No crypto library available
I've searched and all that I've found is install openssl or install python-crypto or update python-dev, I doing everything but not works.
Thank you.

Deployment error on Google App engine launcher for python application

I am trying to deploy a python application on google app engine using google app engine launcher.
The Project ID is same as my application name is app.yaml file
But still I am getting the following error in log.
appcfg.py:2450 An error occurred processing file '': EOF occurred in violation of protocol (_ssl.c:581). Aborting.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 133, in <module>
run_file(__file__, globals())
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 129, in run_file
execfile(_PATHS.script_file(script_name), globals_)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 5509, in <module>
main(sys.argv)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 5500, in main
result = AppCfgApp(argv).Run()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3019, in Run
self.action(self)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 5156, in __call__
return method()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3878, in Update
self._UpdateWithParsedAppYaml(appyaml, self.basepath)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3931, in _UpdateWithParsedAppYaml
self.UpdateVersion(rpcserver, basepath, appyaml, APP_YAML_FILENAME)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3816, in UpdateVersion
return appversion.DoUpload(paths, openfunc)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 2440, in DoUpload
self.error_fh)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 494, in GetResourceLimits
resource_limits.update(_GetRemoteResourceLimits(logging_context))
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 464, in _GetRemoteResourceLimits
yaml_data = logging_context.Send('/api/appversion/getresourcelimits')
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 1750, in Send
result = self.rpcserver.Send(url, payload=payload, **kwargs)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appengine_rpc_httplib2.py", line 236, in Send
url, method=method, body=payload, headers=headers)
File "C:\Program Files (x86)\Google\google_appengine\lib\httplib2\httplib2\__init__.py", line 1584, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "C:\Program Files (x86)\Google\google_appengine\lib\httplib2\httplib2\__init__.py", line 1332, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "C:\Program Files (x86)\Google\google_appengine\lib\httplib2\httplib2\__init__.py", line 1268, in _conn_request
conn.connect()
File "C:\Program Files (x86)\Google\google_appengine\lib\httplib2\httplib2\__init__.py", line 1014, in connect
self.disable_ssl_certificate_validation, self.ca_certs)
File "C:\Program Files (x86)\Google\google_appengine\lib\httplib2\httplib2\__init__.py", line 80, in _ssl_wrap_socket
cert_reqs=cert_reqs, ca_certs=ca_certs)
File "C:\Python27\lib\ssl.py", line 891, in wrap_socket
ciphers=ciphers)
File "C:\Python27\lib\ssl.py", line 566, in __init__
self.do_handshake()
File "C:\Python27\lib\ssl.py", line 788, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:581)
2015-07-13 14:35:47 (Process exited with code 1)

blobstore inside a taskqueue/deferred

I am trying to import a large User Information list from a json file to the datastore using taskqueue and deferred.
A User contains the user's information including an image url from a different app. During the importing process, the image should be grabbed and uploaded to the blob (which works just fine when tested).
I got stuck with getting the blob_key of the uploaded image.
And I think it only occurs inside a taskqueue/deferred because I tried it inside a 'normal' GET request handler, it works just fine.
This is my handler:
class MigrationTask(BaseHandler):
def post(self):
if not self.request.get('file'):
return
json_data = open(self.request.get('file'))
data = json.load(json_data)
json_data.close()
for datum in data['results']:
deferred.defer(push_user_to_db, datum)
this are my functions:
#ndb.transactional(xg=True)
def _push_user_to_db(profilePicture=None, ...):
if profilePicture:
if 'url' in profilePicture:
con = urlfetch.fetch(image_url)
if con.status_code == 200:
file_name = files.blobstore.create(mime_type='application/octet-stream')
with files.open(file_name, 'a') as f:
f.write(con.content)
files.finalize(file_name)
blob_key = files.blobstore.get_blob_key(file_name) # this part is where it errs
image_url = images.get_serving_url(file_name)
# some codes here...
def push_user_to_db(kwargs):
_push_user_to_db(**kwargs)
part of the traceback:
blob_key = files.blobstore.get_blob_key(file_name)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\files\blobstore.py", line 132, in get_blob_key
namespace='')])[0]
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\datastore.py", line 654, in Get
return GetAsync(keys, **kwargs).get_result()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\datastore.py", line 629, in GetAsync
return _GetConnection().async_get(config, keys, local_extra_hook)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastore\datastore_rpc.py", line 1574, in async_get
pbs = [key_to_pb(key) for key in keys]
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\ndb\model.py", line 653, in key_to_pb
return key.reference()
AttributeError: 'Key' object has no attribute 'reference'
PS: I've also tried taskqueue instead of deferred.
EDIT(1):
This is the traceback:
ERROR 2015-03-03 06:32:44,720 webapp2.py:1552] 'Key' object has no attribute 'reference'
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1102, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\deferred\deferred.py", line 310, in post
self.run_from_request()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\deferred\deferred.py", line 305, in run_from_request
run(self.request.body)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\deferred\deferred.py", line 147, in run
return func(*args, **kwds)
File "C:\project directory\migration.py", line 141, in push_user_to_db
_push_user_to_db(**kwargs)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\ndb\utils.py", line 179, in inner_wrapper
return wrapped_decorator(func, args, kwds, **options)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\ndb\model.py", line 3759, in transactional
func, args, kwds, **options).get_result()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\ndb\tasklets.py", line 325, in get_result
self.check_success()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\ndb\tasklets.py", line 371, in _help_tasklet_along
value = gen.send(val)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\ndb\context.py", line 999, in transaction
result = callback()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\ndb\model.py", line 3767, in <lambda>
return transaction_async(lambda: func(*args, **kwds), **options)
File "C:\project directory\migration.py", line 56, in _push_user_to_db
blob_key = files.blobstore.get_blob_key(file_name)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\files\blobstore.py", line 132, in get_blob_key
namespace='')])[0]
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\datastore.py", line 654, in Get
return GetAsync(keys, **kwargs).get_result()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\datastore.py", line 629, in GetAsync
return _GetConnection().async_get(config, keys, local_extra_hook)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastore\datastore_rpc.py", line 1574, in async_get
pbs = [key_to_pb(key) for key in keys]
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\ndb\model.py", line 653, in key_to_pb
return key.reference()
AttributeError: 'Key' object has no attribute 'reference'
Heads up! Writing files to the Blobstore using the files api has been deprecated. I had this issue before. My codes run perfectly fine in development server (localhost) but erred on App Engine server. The solution is to write the files in the Google Cloud Storage via Blobstore API.

Bad Image Error by Google App engine

My problem when trying to resize an image using the image class in google app engine.
The error is displayed below. This happens for every type of image including .jpg,.png,etc
Internal Server Error
The server has either erred or is incapable of performing the requested operation.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1102, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "C:\Users\prudhvir\Desktop\projectbyprudhviraj\main.py", line 252, in post
avatar = images.resize(user_dp, 32, 32)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\images\__init__.py", line 1095, in resize
return rpc.get_result()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 612, in get_result
return self.__get_result_hook(self)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\images\__init__.py", line 886, in execute_transforms_hook
raise _ToImagesError(e, self._blob_key)
BadImageError

Problem with gaesessions (django+GAE)

I'm using gaesessions on gae with django. When I run the application Following error occurs while loading gaesessions.DjangoSessionMiddleware.
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 4053, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3977, in _Dispatch
base_env_dict=env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 588, in Dispatch
base_env_dict=base_env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3050, in Dispatch
self._module_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2954, in ExecuteCGI
reset_modules = exec_script(handler_path, cgi_path, hook)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2836, in ExecuteOrImportScript
script_module.main()
File "D:\projects\tutorial\selftutor.py", line 35, in main
util.run_wsgi_app(application)
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\util.py", line 98, in run_wsgi_app
run_bare_wsgi_app(add_wsgi_middleware(application))
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\util.py", line 116, in run_bare_wsgi_app
result = application(env, _start_response)
File "C:\Program Files\Google\google_appengine\lib\django_1_2\django\core\handlers\wsgi.py", line 252, in __call__
response = middleware_method(request, response)
File "D:\projects\tutorial\gaesessions\__init__.py", line 493, in process_response
patch_vary_headers(response, ('Cookie',))
File "C:\Program Files\Google\google_appengine\lib\django_1_2\django\utils\cache.py", line 127, in patch_vary_headers
if response.has_header('Vary'):
AttributeError: 'NoneType' object has no attribute 'has_header'
Please help me on this.
The middleware does not get handed a response. Check your request handler.

Categories