无法导入名称SIGNATURE_HMAC

时间:2013-03-24 07:29:31

标签: python django python-2.7 importerror hmac

我正在运行django example提供的python-social-auth,并收到以下500服务器错误。

ImportError at /login/bitbucket/
cannot import name SIGNATURE_HMAC
Request Method: GET
Request URL:    http://localhost:8000/login/bitbucket/
Django Version: 1.4.4
Exception Type: ImportError
Exception Value:    
cannot import name SIGNATURE_HMAC
Exception Location: /usr/local/lib/python2.7/dist-packages/requests_oauthlib/core.py in  <module>, line 3
Python Executable:  /usr/bin/python
Python Version: 2.7.3

我在Google和StackOverflow中搜索过,无法找到任何答案。我刚刚克隆了它,并没有改变任何代码。我安装了hashlib和hmac库

[编辑] 我升级了oauthlib和requests_oauthlib,错误被新的替换

AttributeError at /login/bitbucket/
'Request' object has no attribute 'body'
Request Method: GET
Request URL:    http://localhost:8000/login/bitbucket/
Django Version: 1.4.4
Exception Type: AttributeError
Exception Value:    
'Request' object has no attribute 'body'
Exception Location: /usr/local/lib/python2.7/dist-packages/requests_oauthlib/core.py in         __call__, line 46
Python Executable:  /usr/bin/python
Python Version: 2.7.3

1 个答案:

答案 0 :(得分:0)

仅供参考,我通过pip重新安装oauthlib软件包解决了标题中的问题(来自Google)。

sudo pip install --upgrade oauthlib

由于这个问题,我无法打开Ubuntu软件中心,升级oauthlib后一切正常。