Using Python, I am trying to download pictures from my dropbox app but I run into the following error message
"Error downloading file from Dropbox: [Errno 13] Permission denied:"
Here is my code:
import dropbox
ACCESS_TOKEN = "MY SECRET TOKEN"
dropbox_folder_path = r"my_dbx_folder_path"
local_download_path = r"my_local_download_path"
def dropbox_connect():
"""Create a connection to Dropbox."""
try:
dbx = dropbox.Dropbox(ACCESS_TOKEN)
return dbx
except Exception as e:
print('Error connecting to Dropbox with access token:', str(e))
return None
def dropbox_download_file(dropbox_file_path, local_file_path):
"""Download a file from Dropbox to the local machine."""
try:
dbx = dropbox_connect()
if dbx:
with open(local_file_path, 'wb') as f:
response = dbx.files_download(path=dropbox_file_path)
print(response)
f.write(response.content)
except Exception as e:
print('Error downloading file from Dropbox: ' + str(e))
Can I get some advice on what I am doing wrong?