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

I am starting with python api dropbox, I copied the first example, but I get the error

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)

      

the dropbox object has no client attribute, but it has the same documentation code.

tracing

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

      

+3


source to share


1 answer


You named your own script dropbox.py

, you need to rename your script and delete any file dropbox.pyc

. You are trying to import a non-module from your local file dropbox

.



+9


source







All Articles