AttributeError:'module'对象没有属性'client'python dropbox api

时间:2015-05-01 16:46:59

标签: python dropbox

我从python api dropbox开始,我复制了第一个例子,但是我收到了错误

import dropbox

# Get your app key and secret from the Dropbox developer website
app_key = 'MY_APP_KEY'
app_secret = 'MY_APP_SECRET'

flow = dropbox.client.DropboxOAuth2FlowNoRedirect(app_key, app_secret)

dropbox对象没有客户端属性,但它与文档的代码相同。

追溯

/usr/bin/python2.7 /home/user/PycharmProjects/api/dropbox.py
Traceback (most recent call last):
  File "/home/user/PycharmProjects/api/dropbox.py", line 3, in <module>
    import dropbox
  File "/home/user/PycharmProjects/api/dropbox.py", line 9, in <module>
    flow = dropbox.client.DropboxOAuth2FlowNoRedirect(app_key, app_secret)
AttributeError: 'module' object has no attribute 'client'

1 个答案:

答案 0 :(得分:11)

您已调用自己的脚本dropbox.py,需要重命名脚本并删除任何dropbox.pyc文件。您正尝试从本地文件导入而不是dropbox模块。