2

我正在尝试使用Soundcloud-Python库来利用 Soundcloud API。我按照使用说明安装了它,pip install soundcloud并且没有报告任何错误。不知道我在这里做错了什么。

错误跟踪:

Traceback (most recent call last):
  File "uploadToSoundcloud.py", line 1, in <module>
    import soundcloud
  File "/usr/local/lib/python2.7/dist-packages/soundcloud/__init__.py", line 8, in <module>
    from soundcloud.client import Client
  File "/usr/local/lib/python2.7/dist-packages/soundcloud/client.py", line 5, in <module>
    from soundcloud.request import make_request
  File "/usr/local/lib/python2.7/dist-packages/soundcloud/request.py", line 14, in <module>
    from requests.packages.urllib3.filepost import get_content_type, iter_fields
ImportError: cannot import name get_content_type

代码:

import soundcloud

client = soundcloud.Client(
    client_id='f3ddcf1f3e069b44a21115d0d58d6005',
    client_secret='**censored**',
    username='**censored**',
    password='**censored**'
)

print client.get('/me').username
4

1 回答 1

4

这是由于 requests 和 soundcloud-python 的版本不匹配导致的错误。我刚刚推送了 PyPi 的更新。尝试使用 pip install --upgrade soundcloud 安装/升级,然后告诉我进展如何。

于 2013-09-30T14:58:48.537 回答