<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: I am having trouble using with_path_root() with python in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/I-am-having-trouble-using-with-path-root-with-python/m-p/731545#M32336</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is nothing special, or different, that needs to be done when running code in AWS Lambda from the Dropbox side. If it's working locally (in dev), it should work remotely (on a server). Are you able to re-confirm that the same exact code is being run in both environments?&lt;/P&gt;</description>
    <pubDate>Tue, 21 Nov 2023 20:46:41 GMT</pubDate>
    <dc:creator>DB-Des</dc:creator>
    <dc:date>2023-11-21T20:46:41Z</dc:date>
    <item>
      <title>I am having trouble using with_path_root() with python</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/I-am-having-trouble-using-with-path-root-with-python/m-p/731265#M32325</link>
      <description>&lt;P&gt;I have an container-based AWS Lambda that reads from S3 and writes to Dropbox.&amp;nbsp; It has worked for months and it quit working on Saturday (2023-11-17) morning.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given two folders and paths&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;My Team/folder01/folder02&lt;/LI&gt;&lt;LI&gt;Some User&amp;nbsp; # person that created the token&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;using python, when I call&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;files_upload(b'data', 'My Team/folder01/folder02/filename.txt')&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;to write a file:&lt;/P&gt;&lt;P&gt;1. it used to write the file: `My Team/folder01/folder02/filename.txt`&lt;/P&gt;&lt;P&gt;2. now it writes the file: `Some User/My Team/folder01/folder02/filename.txt`&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;After much reading, I have discovered that I need to set the path root for the "team" rather than the "member" or user.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am now doing that with the following two lines:&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;root_namespace_id = dbx.users_get_current_account().root_info.root_namespace_id&lt;BR /&gt;dbx = dbx.with_path_root(dropbox.common.PathRoot.root(root_namespace_id))&lt;/PRE&gt;&lt;P&gt;this works great locally on my development computer, but when I add the two lines to my AWS Lambda logic, it appears to be ignored when I execute it remotely.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given the following four lines:&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;dbx = DropboxTeam(DROPBOX_ACCESS_TOKEN).as_user(DROPBOX_TEAM_USER)&lt;BR /&gt;root_namespace_id = dbx.users_get_current_account().root_info.root_namespace_id&lt;BR /&gt;dbx = dbx.with_path_root(dropbox.common.PathRoot.root(root_namespace_id))&lt;BR /&gt;metadata = dbx.files_upload(&lt;SPAN&gt;b'data'&lt;/SPAN&gt;, &lt;SPAN&gt;'My Team/folder01/folder02/filename.txt'&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I execute those four lines on my local computer the files write to the expected (team) folder&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;My Team/folder01/folder&lt;SPAN&gt;02&lt;/SPAN&gt;/filename.txt&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If my AWS Lambda executes those four lines, it writes to the user/member folder&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;Some User/My Team/folder01/folder&lt;SPAN&gt;02&lt;/SPAN&gt;/filename.txt&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have logged out the&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;root_namespace_id&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;it is the same, both locally and remotely&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only thing I see in the metadata is that&amp;nbsp;&lt;/P&gt;&lt;P&gt;Locally:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;parent_shared_folder_id='12345678'&lt;/LI&gt;&lt;LI&gt;sharing_info=FileSharingInfo(modified_by=...)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Remotely:&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;parent_shared_folder_id=NOT_SET&lt;/LI&gt;&lt;LI&gt;sharing_info=NOT_SET&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Do I need to do something special when making this call in an AWS Lambda?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 21 Nov 2023 00:39:28 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/I-am-having-trouble-using-with-path-root-with-python/m-p/731265#M32325</guid>
      <dc:creator>jdavey</dc:creator>
      <dc:date>2023-11-21T00:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: I am having trouble using with_path_root() with python</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/I-am-having-trouble-using-with-path-root-with-python/m-p/731545#M32336</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is nothing special, or different, that needs to be done when running code in AWS Lambda from the Dropbox side. If it's working locally (in dev), it should work remotely (on a server). Are you able to re-confirm that the same exact code is being run in both environments?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 20:46:41 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/I-am-having-trouble-using-with-path-root-with-python/m-p/731545#M32336</guid>
      <dc:creator>DB-Des</dc:creator>
      <dc:date>2023-11-21T20:46:41Z</dc:date>
    </item>
  </channel>
</rss>

