由于我更新到最新版本的django facebook,我收到此错误:
TypeError at /facebook/connect/
open() got an unexpected keyword argument 'timeout'
以下是完整的引用:
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.5/site-packages/django/views/decorators/csrf.py" in wrapped_view
77. return view_func(*args, **kwargs)
File "/usr/lib/python2.5/site-packages/django_facebook/decorators.py" in _wrapped_view
92. get_persistent_graph(request, redirect_uri=current_uri)
File "/usr/lib/python2.5/site-packages/django_facebook/api.py" in get_persistent_graph
62. graph = get_facebook_graph(request, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/django_facebook/api.py" in get_facebook_graph
161. code, redirect_uri=redirect_uri)
File "/usr/lib/python2.5/site-packages/open_facebook/api.py" in convert_code
251. response = cls.request('oauth/access_token', **kwargs)
File "/usr/lib/python2.5/site-packages/open_facebook/api.py" in request
75. response = cls._request(url, post_data)
File "/usr/lib/python2.5/site-packages/open_facebook/api.py" in _request
110. timeout=timeout)
Exception Type: TypeError at /facebook/connect/
Exception Value: open() got an unexpected keyword argument 'timeout'
答案 0 :(得分:1)
我通过从这里删除超时参数来“修复”这个:
/usr/lib/python2.5/site-packages/open_facebook/api.py
超时参数位于评论的正下方,说明这个参数可以省略旧的python版本。
答案 1 :(得分:0)
认为你应该尝试升级你正在使用的Python版本(或者更好的是,使用virtualenv!)
看起来你正在使用Python 2.5这很老,所以也许你得到了这个错误,因为库依赖于那个可能在2.6或2.7等中添加的timeout = keyword参数。
来自https://github.com/tschellenbach/Django-facebook/blob/master/open_facebook/api.py#L92
,看起来像是在urllib2.OpenerDirector上调用open(),所以可能在某处添加了timeout关键字arg