Web应用程序中的内部服务器错误:使用Python的Google App Engine中的Google Latitude API

2024-09-30 08:36:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我是python和googleappengine的新手。我目前正在开发一个基于位置的web应用程序,我使用了以下示例代码http://code.google.com/p/latitudesample/

我可以在本地主机上运行该程序,但是当我部署该程序并尝试访问该网站时,我收到一条内部服务器错误消息。在

我查看了App Engine日志文件,如下所示:

argument 2 to map() must support iteration
Traceback (most recent call last):File"/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 700, in __call__
handler.get(*groups)
File "/base/data/home/apps/s~latitudesocial/1.351807357650160822/main.py", line 57, in get
self.request.host_url + OAUTH_CALLBACK_PATH, parameters)
File "/base/data/home/apps/s~latitudesocial/1.351807357650160822/oauth_webapp.py", line 28, in redirect_to_authorization_page
request_token = helper.GetRequestToken(callback_url, parameters)
File "/base/data/home/apps/s~latitudesocial/1.351807357650160822/oauth_appengine.py", line 78, in GetRequestToken
None)
File "/base/data/home/apps/s~latitudesocial/1.351807357650160822/oauth.py", line 262, in sign_request
self.build_signature(signature_method, consumer, token))
File "/base/data/home/apps/s~latitudesocial/1.351807357650160822/oauth.py", line 266, in build_signature
return signature_method.build_signature(self, consumer, token)
File "/base/data/home/apps/s~latitudesocial/1.351807357650160822/oauth.py", line 632, in build_signature
oauth_request, consumer, token)
File "/base/data/home/apps/s~latitudesocial/1.351807357650160822/oauth.py", line 623, in build_signature_base_string
key = '%s&' % escape(consumer.secret)
File "/base/data/home/apps/s~latitudesocial/1.351807357650160822/oauth.py", line 50, in escape
return urllib.quote(s, safe='~')
File "/base/python_runtime/python_dist/lib/python2.5/urllib.py", line 1214, in quote
res = map(safe_map.__getitem__, s)
TypeError: argument 2 to map() must support iteration

我一直在努力想办法解决这个问题,但到目前为止我还没有取得任何进展。在

我猜第623行出了问题oauth.py公司在

如果可以,请帮我定位错误。在

^{pr2}$

我对主.py是:

class SetMyOauth(webapp.RequestHandler): 
    def get(self): 
        Config.set('oauth_consumer_key', 'myconsumerkey'), 
        Config.set('oauth_consumer_secret', 'myconsumersecret'), 
        self.response.out.write ("""key and secret set""") 

(更新17/7/2011)

经过进一步的查询,我在运行调试器时遇到了以下错误

C:\Python25\lib\threading.py:699: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
  return _active[_get_ident()]
Exception exceptions.SystemError: 'error return without exception set' in <generator object at 0x03C41378> ignored

它强调了以下代码:

def escape(s):
    """Escape a URL including any /."""
    return urllib.quote(s, safe='~')

它与日志文件中记录的代码相同。在

然而,当我在服务器上运行代码时,没有错误。在


Tags: appsinpybuildselfhomedatabase

热门问题