Install & Compatibility
Where this runs
tested against v12.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 6.014s · 34.6MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.3s · import 5.810s · 35MB
35MB installed
● package 35MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Dropbox
✓ import dropbox
dbx = dropbox.Dropbox(...)
AuthError
✓ from dropbox.exceptions import AuthError
ApiError
✓ from dropbox.exceptions import ApiError
This quickstart demonstrates how to authenticate with the Dropbox API using an access token loaded from the `DROPBOX_ACCESS_TOKEN` environment variable and then list the contents of your Dropbox root folder.
import os
import dropbox
from dropbox.exceptions import AuthError, ApiError
DROPBOX_ACCESS_TOKEN = os.environ.get('DROPBOX_ACCESS_TOKEN', '')
if not DROPBOX_ACCESS_TOKEN:
print("Error: DROPBOX_ACCESS_TOKEN environment variable not set.")
print("Please set it to your Dropbox API access token.")
exit(1)
try:
# Initialize Dropbox client
dbx = dropbox.Dropbox(DROPBOX_ACCESS_TOKEN)
# Test connection by listing files in the root folder
print("\nConnected to Dropbox. Listing root folder content...")
response = dbx.files_list_folder('')
for entry in response.entries:
print(f" {entry.name} ({type(entry).__name__})")
print("\nSuccessfully listed folder content.")
except AuthError:
print("Error: Invalid or expired access token. Please check DROPBOX_ACCESS_TOKEN.")
except ApiError as err:
print(f"API Error: {err}")
except Exception as err:
print(f"An unexpected error occurred: {err}")
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'dropbox'
This error occurs when the `dropbox` library is not installed in the Python environment being used, or the environment's `PYTHONPATH` does not include the installation location, or there are multiple Python versions/environments, and it was installed in a different one.
fixEnsure the library is installed in the correct environment using `pip install dropbox`. If multiple Python versions exist, specify the interpreter (e.g., `python3 -m pip install dropbox`).
AttributeError: module 'dropbox' has no attribute 'Dropbox'
This error most commonly happens when the Python script itself is named `dropbox.py`. When `import dropbox` is called, Python imports the local file instead of the installed library, and the local file does not contain the `Dropbox` class.
fixRename your Python script to something other than `dropbox.py` (e.g., `my_dropbox_app.py`) and delete any `dropbox.pyc` file in the same directory.
dropbox.exceptions.AuthError: AuthError('invalid_access_token', None)
This error indicates that the provided access token is expired, revoked, malformed, or lacks the necessary permissions (scopes) for the attempted operation. Dropbox now uses short-lived tokens and refresh tokens, requiring a refresh mechanism for long-term access.
fixObtain a new access token. If using offline access, ensure you are storing and correctly using a refresh token to generate new short-lived access tokens before they expire. Verify that the app's permissions (scopes) in the Dropbox App Console match the API calls being made.
dropbox.exceptions.ApiError: ApiError(..., LookupError('not_found', None))
This specific `ApiError` (often showing 'path/not_found') means that the file or folder path specified in the API call does not exist in the connected Dropbox account, or there is a typo in the path, or the app lacks access to that particular path due to its access type (e.g., 'app folder' vs 'full Dropbox').
fixDouble-check the exact path on Dropbox. Ensure the app has the correct access type configured in the Dropbox App Console ('App folder' apps can only access files within their dedicated app folder). Use `dbx.files_list_folder('')` to verify paths from the root if unsure. Upgrade
Version history
12.2.1latest on PyPI · released Jul 20, 2026
Audit
Dependencies
requestsrequiredUsed for underlying HTTP requests; incorrect pinning was fixed in v12.0.1.
urllib3requiredUsed for underlying HTTP connections; unpinned in v12.0.2.
stonerequiredInternal dependency for API schema generation and serialization.