Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Thang2000
3 years agoExplorer | Level 4
why there is no option for write mode for move/copy files
I notice there is an option to use writemode
mode=dropbox.files.WriteMode.overwrite
when using uploading API ( dbx.files_upload() ), but there is no option for copying/moving file api. Can we add that? I'm using Python SDK:
dbx.files_move_v2()
dbx.files_copy_v2()
and have been writing many boilerplates to handle file conflicts.
Also, what is the proper way to handle this, right now I'm doing:
try:
dbx.files_copy_v2(from_path=entry.path_display, to_path=path_to_autopdf_folder)
except WriteConflictError as e:
but getting "catching classes that do not inherit from baseexception is not allowed python".
Appreciate the help.
2 Replies
- Здравко3 years agoLegendary | Level 20
Thang2000 wrote:
...
Also, what is the proper way to handle this, right now I'm doing:try: dbx.files_copy_v2(from_path=entry.path_display, to_path=path_to_autopdf_folder) except WriteConflictError as e:but getting "catching classes that do not inherit from baseexception is not allowed python".
...Hi Thang2000,
In most programing languages not all types can be thrown (and catched, of course), but only a subset (so called throwable types). As you saw already, in Python that subset is form of types inherited from the mentioned class. That's it. Here make a note that you are trying to catch WriteConflictError class' object; a class that is regular, non throwable (i.e. not exception) class. All errors that comes from API use ApiError class as a carrier. There you can inspect what's in error field to see what's the actual error (including its type). You may put the carrier class in all similar except statements where the target is Dropbox API and once catch the error actual error type can be found out. 😉
Hope this clarifies matter to some extent.
- Greg-DB3 years ago
Dropbox Community Moderator
Thang2000 I'll pass this along as a feature request for support for setting the write mode when moving/copying files, but I can't promise if or when that might be implemented.
Also, you can find an example of catching an API error in the Python SDK here.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!