<?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: Dropbox API Creating Shared link settings Error. in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/482878#M24316</link>
    <description>&lt;P&gt;A 'path/not_found' error like this indicates that creating the shared link failed because there was nothing found at the specified path to link to. In this case, based on the error output, this is referring to the path you're supplying in your 'dailyfile_csv' variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You'll need to check why there isn't anything at that path. Perhaps you meant to upload something there, but didn't do so successfully. Or, perhaps your 'dailyfile_csv' value is just incorrect.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Dec 2020 19:41:08 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2020-12-29T19:41:08Z</dc:date>
    <item>
      <title>Dropbox API Creating Shared link settings Error.</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/482862#M24314</link>
      <description>&lt;P&gt;I have a program in Python 3.9 which cleans data every morning, creates a final dataset, and then uses the dropbox api to create a shared link with settings (password) for the file, then email that link with the password to those who subscribe to my daily newsletter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This setup works... but only some of the time. For many months it was completely reliable, but now the creating shared link settings break the whole program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By some of the time, I mean that the program will work Monday, Tuesday, Wednesday, but break on Thursday.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Luckily, I do get a continuous error, but am writing this because I am unable to find a fix.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code:&lt;/P&gt;
&lt;PRE&gt;import dropbox&lt;BR /&gt;dailyfile_csv = "\Daily Data (2020-12-29 10.07 AM).csv"&lt;BR /&gt;dailyfile_dta = "\Daily Data (2020-12-29 10.07 AM).dta"&lt;BR /&gt;&lt;BR /&gt;/Daily Lobbying Data (2020-12-29 10.07 AM).dta&lt;BR /&gt;dbx = dropbox.Dropbox(token)
user = dbx.users_get_current_account()
print("Dropbox Account Info: " + str(dbx.users_get_current_account()))
#Should have logged onto dropbox application.


#STEP: Creating randomly generated passwords for the data.
csvpass = str(randompassword())
print("CSV Password = " + csvpass)
dtapass = str(randompassword())
print("DTA Password = " + dtapass)
#Created randomly generated passwords for the data.


#These are link settings for the files which say that the file requires a password, and we set the password equal to the randomly generated passwords above.
link_settings_csv = dropbox.sharing.SharedLinkSettings(
        requested_visibility = dropbox.sharing.RequestedVisibility.password,
        link_password=csvpass)
        #expires = datetime.datetime.now() + datetime.timedelta(days=7))

link_settings_dta = dropbox.sharing.SharedLinkSettings(
        requested_visibility = dropbox.sharing.RequestedVisibility.password,
        link_password=dtapass)
        #expires = datetime.datetime.now() + datetime.timedelta(days=7))
#Setting link settings as requiring password.

time.sleep(15)

#STEP: VERY IMPORTANT. This creates a link for the huge data file either in csv or dta format to be sent in the daily emails.
csv_link = dbx.sharing_create_shared_link_with_settings(dailyfile_csv,settings=link_settings_csv).url
time.sleep(10)
print(csv_link)
time.sleep(7)
dta_link = dbx.sharing_create_shared_link_with_settings(dailyfile_dta,settings=link_settings_dta).url
time.sleep(10)
print(dta_link)
time.sleep(7)
print("Finished creating dropbox links.")&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Error Code:&lt;/P&gt;
&lt;PRE&gt;#This happens right after attempting to create the first shared link.&lt;BR /&gt;Traceback (most recent call last):
  File "D:\Dropbox\Lobbyingdata.com\Lobbying Data\Daily_Data_Step_3_Dropboxing.py", line 102, in &amp;lt;module&amp;gt;
    csv_link = dbx.sharing_create_shared_link_with_settings(dailyfile_csv,settings=link_settings_csv).url
  File "C:\Users\syxsc\AppData\Roaming\Python\Python39\site-packages\dropbox\base.py", line 3969, in sharing_create_shared_link_with_settings
    r = self.request(
  File "C:\Users\syxsc\AppData\Roaming\Python\Python39\site-packages\dropbox\dropbox_client.py", line 338, in request
    raise ApiError(res.request_id,
dropbox.exceptions.ApiError: ApiError('dd1470bb63b1468b977c6c3fdd30afdc', CreateSharedLinkWithSettingsError('path', LookupError('not_found', None)))&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2021 10:11:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/482862#M24314</guid>
      <dc:creator>Nellyb43</dc:creator>
      <dc:date>2021-01-04T10:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API Creating Shared link settings Error.</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/482878#M24316</link>
      <description>&lt;P&gt;A 'path/not_found' error like this indicates that creating the shared link failed because there was nothing found at the specified path to link to. In this case, based on the error output, this is referring to the path you're supplying in your 'dailyfile_csv' variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You'll need to check why there isn't anything at that path. Perhaps you meant to upload something there, but didn't do so successfully. Or, perhaps your 'dailyfile_csv' value is just incorrect.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 19:41:08 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/482878#M24316</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-12-29T19:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API Creating Shared link settings Error.</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/482883#M24318</link>
      <description>&lt;P&gt;So, when running my program I generate the dataset in a folder not in the dropbox app folder, then use shurtil.copyfile to copy that file into the dropbox application folder.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;shutil.copyfile(oldpath,dropbox_app_path)&lt;/PRE&gt;&lt;P&gt;Then to create dailyfile_csv I do&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;dailyfile_csv = newpath_csv_dbx.replace('\\','/')[40:]&lt;/PRE&gt;&lt;P&gt;This takes something like ""D:\Dropbox\Apps\App Folder Name\Daily Data (2020-12-29).dta" and turns it into "/Daily Data (2020-12-29).dta", which is what the dropbox api wants.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do indeed see my file "dailyfile_csv" in the application folder - is there anything else that may be going on?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 20:00:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/482883#M24318</guid>
      <dc:creator>Nellyb43</dc:creator>
      <dc:date>2020-12-29T20:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API Creating Shared link settings Error.</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/482884#M24319</link>
      <description>&lt;P&gt;That smiley face is actually:&amp;nbsp; "40 colon ]"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 20:01:12 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/482884#M24319</guid>
      <dc:creator>Nellyb43</dc:creator>
      <dc:date>2020-12-29T20:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API Creating Shared link settings Error.</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/482906#M24320</link>
      <description>&lt;P&gt;So I ended up finding a fix for this by having my program wait 60 seconds with time.sleep(60) and somehow the sharing works perfectly again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please correct me if I am wrong but I am guessing the sync for the app folder is not instantaneous, especially due to the massive size of the files I attempt to share. Since the sync needs some time, I add a waiting period of a minute in order to ensure that the big file has been transferred and synced from my internal folders to the dropbox app folder.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 21:03:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/482906#M24320</guid>
      <dc:creator>Nellyb43</dc:creator>
      <dc:date>2020-12-29T21:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API Creating Shared link settings Error.</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/482908#M24321</link>
      <description>&lt;P&gt;Right, uploads are not instantaneous. Given your description, it looks like you're writing to the local filesystem and are relying on the&amp;nbsp;Dropbox desktop client to upload the file to Dropbox. The file needs to be uploaded to Dropbox, not just written to the local filesystem, before&amp;nbsp;sharing_create_shared_link_with_settings will work for it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, your API&amp;nbsp;sharing_create_shared_link_with_settings code was apparently running before the file was actually uploaded, which would lead to the error. (This could happen when the upload takes a bit of time, or if the client isn't running, etc.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also use other API methods such as &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.Dropbox.files_get_metadata" target="_self"&gt;files_get_metadata&lt;/A&gt; or&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.Dropbox.files_list_folder" target="_self"&gt;files_list_folder&lt;/A&gt;/&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.Dropbox.files_list_folder_continue" target="_self"&gt;files_list_folder_continue&lt;/A&gt; to check what files exist on&amp;nbsp;Dropbox first.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 21:10:24 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/482908#M24321</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-12-29T21:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API Creating Shared link settings Error.</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/482922#M24322</link>
      <description>&lt;P&gt;Very interesting. Do you recommend I upload the file straight to dropbox using the API over using util to simply copy it over from my local directory?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I arbitrarily chose 60 seconds of time to give dropbox time to fully sync up the file in the application folder. Each file is on average 500MB. Do you recommend I go with a longer length of time just to make sure the sync works with sharing no matter what. One minute here and there is no issue.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 22:02:54 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/482922#M24322</guid>
      <dc:creator>Nellyb43</dc:creator>
      <dc:date>2020-12-29T22:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API Creating Shared link settings Error.</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/483077#M24325</link>
      <description>&lt;P&gt;You can certainly use the API to upload files instead (&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.Dropbox.files_upload" target="_self"&gt;files_upload&lt;/A&gt; for files smaller than 150 MB, or &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.Dropbox.files_upload_session_start" target="_self"&gt;upload sessions&lt;/A&gt; otherwise). That would be helpful in that the code would directly know when the file is completely uploaded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's not strictly necessary though. You can use other functionality on the API to detect changes, e.g., to determine when the file is uploaded. Check out &lt;A href="https://www.dropbox.com/lp/developers/reference/detecting-changes-guide" target="_self"&gt;the Detecting Changes Guide&lt;/A&gt; for more information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case, I wouldn't&amp;nbsp;recommend just waiting some amount of time, as that could be unreliable.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2020 14:30:50 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/483077#M24325</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-12-30T14:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API Creating Shared link settings Error.</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/483271#M24338</link>
      <description>&lt;P&gt;Thank you so much! I have changed my code to allow for uploading of the file from the api rather than just moving it into my file directory. The program is running smoothly now and with no hickups.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2020 05:14:34 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-Creating-Shared-link-settings-Error/m-p/483271#M24338</guid>
      <dc:creator>Nellyb43</dc:creator>
      <dc:date>2020-12-31T05:14:34Z</dc:date>
    </item>
  </channel>
</rss>

