TypeError: 'module' object is not callable (dropbox.dropbox())
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?
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)
I tried that before, and got this error
AttributeError: module 'dropbox' has no attribute 'Dropbox'
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').