Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Python: Can't delete file from Dropbox?
-
I use Editorial exclusively with Dropbox synced files. Having found no way to programatically rename a document, I've created a workflow that just makes a named copy and deletes the original. It's something along these lines:
- Store current filename with editor.get_path()
- Set a variable with the first line of text
- Set a variable with the full contents of the file
- Create a new document, filled with the values of the previous variables
- Delete the previous file with os.remove()
The problem is that when the workflow is run, a "renamed" file is created, but the original is only emptied down to zero bytes; I still see it in the file list.
I tested the workflow with a local file and everything worked fine.
What's wrong with Dropbox? Is it a bug? Is there a way around it?
Thanks
-
If you want to manage files that are in Dropbox, you'll have to do so using the Dropbox SDK. Editorial's sync mechanism is not prepared for changes "behind its back", so you basically shouldn't ever touch synced files directly.
-
Would "sync with dropbox" in the process not work?
ex:
create new document, delete old document, sync with dropbox, refresh view?
-
@RNC No, that wouldn't work. The sync engine needs to be informed that the file was intentionally deleted (and that's not supported programmatically), otherwise, it would re-download a fresh copy...
-
The Dropbox SDK will only manage files when connected, correct? So just to clarify, there is no workflow or other offline equivalent to either swiping left on a file to delete, or using the in-editor feature to rename a file.?