dropbox-sdk-python icon indicating copy to clipboard operation
dropbox-sdk-python copied to clipboard

TypeError: 'module' object is not callable (dropbox.dropbox())

Open guppy57 opened this issue 8 years ago • 3 comments

I'm using the dropbox tutorial for python, but I'm still running into this error.

Code:

import dropbox

d = dropbox.dropbox(oauth2_access_token = ACCESS_TOKEN)
d.users_get_current_account()`

Error:

    d = dropbox.dropbox(oauth2_access_token = ACCESS_TOKEN)
TypeError: 'module' object is not callable

Does anyone know what I'm doing wrong?

guppy57 avatar Jan 15 '18 21:01 guppy57

That constructor should be dropbox.Dropbox (not dropbox.dropbox). That is, the code should look like this:

d = dropbox.Dropbox(oauth2_access_token=ACCESS_TOKEN)

greg-db avatar Jan 15 '18 21:01 greg-db

I tried that before, and got this error

AttributeError: module 'dropbox' has no attribute 'Dropbox'

guppy57 avatar Jan 15 '18 22:01 guppy57

In that case, make sure you have the latest version of the SDK installed (older versions didn't have that constructor), and make sure you don't have your own module named 'dropbox' (e.g., any Python files or folders you may have also named 'dropbox').

greg-db avatar Jan 15 '18 23:01 greg-db