AttributeError: 'module' object has no attribute 'client' python dropbox api

AttributeError: 'module' object has no attribute 'client' python dropbox api

我从 python api 保管箱开始,我复制了第一个示例,但出现错误

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)

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

回溯

/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'

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