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
Joe_AR
8 months agoHelpful | Level 5
API folder creation
I'm using Google Colab + Python to create a list of folder from a googleSheet of my open projects. I set-up the App in dropbox & the code runs without error. It checks to see if the folder path already exists before creation. Ran the 1st time & received confirmation the folders were created. Ran the 2nd time and it said the folders had already been created - this is expected on a 2nd run. However, the folders are not appearing listed when I log in.
I've checked the path that the path is correct & that i'm navagating to the correct place in dropbox. Is there a reason the api would return the folders are created but not visible? Its been about 25 minutes and they're still not showing - I've heard the API sync can be delayed.
for job_name, job_number in zip(job_names, job_numbers):
folder_name = f"{job_name}{job_number}"
folder_path = f"{parent_folder_path}{folder_name}" # Absolute path to the new folder
print(folder_path)
try:
# Check if the folder already exists
metadata = dbx.files_get_metadata(folder_path)
print(f"Folder '{folder_name}' already exists in Dropbox.")
except dropbox.exceptions.ApiError as err:
# If folder doesn't exist, create it
if err.error.is_path() and err.error.get_path().is_not_found():
try:
dbx.files_create_folder(folder_path)
print(f"Folder '{folder_name}' created in Dropbox.")
except dropbox.exceptions.ApiError as err:
print(f"Failed to create folder '{folder_name}' in Dropbox: {err}")
else:
print(f"Error checking folder '{folder_name}' in Dropbox: {err}")
I'm not a programmer by trade/training or developer - and there's more to the code not shown here...
Is there a limit of the number of errors or attempts? I have run this probably 100 times in the last 24 hours before I got this far.
Hey Zdravko,
Just reran it this AM and its working. I started with the documenation and added a missing parameter. The folders were visible when I logged in under the 'suggested folders'. I did notice - to your point - that I was creating the folders in the wrong path.
The absolute path I was creating was wrong:# Define the parent folder pathparent_folder_path = 'home/(my user name)/000 - Shipping Photos/' # Absolute path to the parent folderShould have just been:
# Define the parent folder pathparent_folder_path = '/000 - Shipping Photos/' # Absolute path to the parent folderWent I went to navagate to the folder upon successful creation of the folders - I noted the nested path was duplicated:
/home/(user name)/000 -Shipping Photos/home/(user name)/000 - Shipping Photos/
Stupid error on top of stupid error. Splinter removed from my mind. Thank you for the feedback & help.
- ЗдравкоLegendary | Level 20
Hi Joe_AR,
There are many different things that could get wrong that may lead you to such a state. It's difficult to point one (impossible actually). Typical mistakes are:
- wrong account authenticated - you're putting files/folders in one account (authorized your application by mistake) and expect the same files/folders on other account. Check the actual account your application has linked to.
- app folder application type - registered application type suppose limited access to associated account and all files/folders are put in the corresponding application's subfolder (not in account root), where you're looking on. Check is your application type limited to app folder in app settings.
- team account put everything in members folder, by default - your business account assume you want to put something in your private space. Check there, not in the account root.
Of course there might be many others, but the above are most typical confusion cases and that's why you can start from them. 😉
Hope this helps.
- Joe_ARHelpful | Level 5
Hey Zdravko,
Just reran it this AM and its working. I started with the documenation and added a missing parameter. The folders were visible when I logged in under the 'suggested folders'. I did notice - to your point - that I was creating the folders in the wrong path.
The absolute path I was creating was wrong:# Define the parent folder pathparent_folder_path = 'home/(my user name)/000 - Shipping Photos/' # Absolute path to the parent folderShould have just been:
# Define the parent folder pathparent_folder_path = '/000 - Shipping Photos/' # Absolute path to the parent folderWent I went to navagate to the folder upon successful creation of the folders - I noted the nested path was duplicated:
/home/(user name)/000 -Shipping Photos/home/(user name)/000 - Shipping Photos/
Stupid error on top of stupid error. Splinter removed from my mind. Thank you for the feedback & help.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,882 PostsLatest Activity: 10 hours agoIf 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!