You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

ronan4's avatar
ronan4
Explorer | Level 3
8 months ago

Re: files_get_metadata Python API stopped working

Same issue again 24/04/24

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

    ronan4 I just tried this out and I'm not able to reproduce that issue, so we'll need some more information so we can look into this for you. Please share:

    • the name and version number of the platform and SDK/library you are using, if any
    • the steps to reproduce the issue, including relevant code snippet(s), but don't include any access or refresh token(s)
    • the full text of any error or unexpected output
    • ronan4's avatar
      ronan4
      Explorer | Level 3

      Thanks Greg.  

       

      ## python version

      3.11.7

       

      ## dropbox version

      C:\Windows\System32>pip show dropbox
      Name: dropbox
      Version: 11.36.2
      Summary: Official Dropbox API Client
      Home-page: http://www.dropbox.com/developers
      Author: Dropbox
      Author-email: dev-platform@dropbox.com
      License: MIT License
      Location: C:\Users\ronan\AppData\Local\Programs\Python\Python311\Lib\site-packages
      Requires: requests, six, stone
      Required-by:

       

      ## error:

      metadata = dbx.files_get_metadata(file_path)
      Traceback (most recent call last):
      File "<pyshell#177>", line 1, in <module>
      metadata = dbx.files_get_metadata(file_path)
      File "C:\Users\ronan\AppData\Local\Programs\Python\Python311\Lib\site-packages\dropbox\base.py", line 1671, in files_get_metadata
      r = self.request(
      File "C:\Users\ronan\AppData\Local\Programs\Python\Python311\Lib\site-packages\dropbox\dropbox_client.py", line 351, in request
      raise ApiError(res.request_id,
      dropbox.exceptions.ApiError: ApiError('fd8b5fde18204a0baf24422ebdff53f6', GetMetadataError('path', LookupError('not_found', None)))

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

        Thanks for following up with the additional information. I see in this case you are getting a "path/not_found"  error.

         

        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, your 'file_path' variable value in this case, 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 a currently accurate path value: You can use files_list_folder and files_list_folder_continue to list the contents of a folder so you can check what the correct path values would be for items in those folder(s). To list the root, set path to the empty string "" when calling files_list_folder. You can use the path_lower or id values returned for the files/folders in that folder to interact with those files/folders.

         

        • Make sure you're connected to the correct account for the path value you're using: You can use users_get_current_account to check which account the app is connected to.

         

        • 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.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,910 PostsLatest Activity: 3 days ago
333 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!