We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

escanzano's avatar
escanzano
New member | Level 2
2 years ago

Download a single file but getting API error

I have a file at /Commercial/Revenue Cycle/RC Tracker_Automated.xslx.

 

metadata = dropbox.client.files_download_to_file(path="/Commercial/Revenue Cycle/RC Tracker_Automated.xlsx", download_path=".")

 This gives an error

raise ApiError(res.request_id,
dropbox.exceptions.ApiError: ApiError('f5b0b8df42f945bf966bbd840b5e9c67', DownloadError('path', LookupError('not_found', None)))

 

If I specify a path="" I do not get an error. If I specify any path, I get an error. Why?

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    Hi escanzano,

    You have one error for sure: 'download_path' should point to file where to save downloaded content, not to folder.

    The actual exception, you got, means that something within the Dropbox path is not correct. A good way to start troubleshooting is to list files from account root up to desired file - folder' level by folder' level, starting with empty path (always correct). In such a way you will figure out how exactly you can address the file.

    Good luck.

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

    Здравко As Здравко said, the 'download_path' should refer to a local file path where you want to save the file; not a folder.

     

    And as for the 'path/not_found' error, as they said that's referring to the path on Dropbox itself. A "path/not_found" Dropbox API error indicates that the API call failed because there was nothing currently found at the specified path in the connected account under the relevant root. For example, this can happen if there's a mistake or typo in the path value the app supplies, if the file/folder has been renamed, moved, or deleted from that path, if the app is not connected to the correct account for that particular path, etc.

     

    When specifying the path, make sure you provide the full and accurate path for the desired file under the relevant root. For example, if you have a file named "example.csv" inside a folder named "folder", the path would be "/folder/example.csv". You can find more information on path formats here.

     

    Here are several things you can check in particular to debug this:

     

     

     

    • Make sure you're using app folder-relative paths, if your app is registered for the "app folder" access type: Apps with the "app folder" access type can only access the contents of the special app folder that gets automatically created for it. If your app has the "app folder" access type, then it will only be able to access files in the app folder, and the root for any path value supplied by that app will automatically be the app folder root. You can find more information on app permissions here. For example, If your app has the app folder access type and you're trying to access something you can see on the Dropbox web site at "/Apps/<app folder name>/folder/example.csv", you should only send the path value as "/folder/example.csv".

     

    • Make sure you're accessing the relevant root: When using an app with the "full Dropbox" access type, API calls default to the member folder, but if you're trying to access the "team space" (only applicable to members of a team with the "team space" configuration), you'll need to configure that as the root explicitly, as covered in the Team Files Guide. In the Dropbox Python SDK, you would set that using with_path_root.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,878 PostsLatest Activity: 43 minutes ago
326 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!