Forum Discussion

andrwfrost's avatar
andrwfrost
New member | Level 2
6 years ago

Dropbox API Error when downloading image to raspi

Hi guys, im a total noob in this kind of topic. I got an error messages when i try to download an image from my dropbox with api key.

This is the code:

import dropbox

dbx = dropbox.Dropbox("orHc3wTGXpAAAAAAAAAAftTm4_Z......")

dropboxPath = "/"
filename='picked_image1981016614414776853.jpg'
dbx.files_download_to_file("Copy of "+filename, dropboxPath+filename)

 

And this is the error message:

sudo python3 tesdownload.py
Traceback (most recent call last):
File "tesdownload.py", line 7, in <module>
dbx.files_download_to_file("Copy of "+filename, dropboxPath+filename)
File "/usr/local/lib/python3.5/dist-packages/dropbox/base.py", line 1141, in files_download_to_file
None,
File "/usr/local/lib/python3.5/dist-packages/dropbox/dropbox.py", line 296, in request
user_message_locale)
dropbox.exceptions.ApiError: ApiError('9aef17aad8ae453cea278550b962d978', DownloadError('path', LookupError('not_found', None)))

 

Can anyone help me with this one pls, im a complete noob :(

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    This 'not_found' error indicates that "There is nothing at the given path". That is referring to the remote path on Dropbox for the file you requested to download. 

    For the 'files_download_to_file' method, that's the second parameter, to which you are supplying the path "/picked_image1981016614414776853.jpg" according to this code. 

    Are you sure that's the correct path? Note that if that access token is for a "Full Dropbox" app, the path should be the full path to the file, relative to the Dropbox folder, including any/all parent folders. If the access token is for an "app folder" app, the path should only be relative to the app folder itself.