Coder Social home page Coder Social logo

Comments (10)

Jean-Low avatar Jean-Low commented on June 24, 2024 1

Found a workaround:
(I'm using this commit because dropbox API changed)

This error seems to occur when there is an empty new folder created recently on the directory. I made an try except to simply skip the function if this error occurs:

`
def restore_file(client, path, cutoff_datetime, is_deleted, verbose=False):

try:

    revisions = client.files_list_revisions(path.encode('utf8'))

except:

    print('custom skip on: ', path.encode('utf8'))

    return

`

also, there is another error from similar origins when get the revision_dict keys: max() don't work if it is empty. so I also changed this line:
if max(revision_dict.keys()) < cutoff_datetime:
for this:
if len(revision_dict.keys()) > 0 and max(revision_dict.keys()) < cutoff_datetime:

This worked (almost) perfectly to restore an Unity 3D project folder that was corrupted.
Hope it helps.

*Sorry for bad english...

from dropbox-restore.

Jean-Low avatar Jean-Low commented on June 24, 2024

Same error here

from dropbox-restore.

elsigh avatar elsigh commented on June 24, 2024

This helped me as well - do you want to create a Pull Request or do you want me to?

from dropbox-restore.

elsigh avatar elsigh commented on June 24, 2024

but it's true, this is a diff for the other (working for me too) version of restore.py.

from dropbox-restore.

A3003 avatar A3003 commented on June 24, 2024

Pardon my less knowledge about python. I am not sure exactly where to insert the code given by Lightclawjl. I tried inserting the code but its gave me some error message about the "except" part. Dont remember the exact error. Can anybody repost the code here merging the additional codes provided by Lightclawjl . And thanks a lot Lightclawjl for posting the resolution.

from dropbox-restore.

tothbog avatar tothbog commented on June 24, 2024

I tried the workaround of Lightclawjl, but it skipped many directories which were not empty, and their files are actually in the cache directory. Is there another way to correct the code?

For A3003: You should change the revisions = client.files_... line for the 4 lines of Lightclawjl, but be aware that indenting is important in python, to try and except has to be indented as revisions = client.files_... was, the 2 other lines 4 spaces more to the right.

from dropbox-restore.

Arakade avatar Arakade commented on June 24, 2024

Hi,
Thanks for original author and all others for work to keep this up-to-date.
I encountered both the DropBox API problem and this error so updated the script.
I don't have time to pull request right now (and haven't tested it on other platforms, etc which the original author seems to require) so here's a quick Gist of it:

https://gist.github.com/Arakade/50f47ab38d8ab0c3bb2ebf29d2795119

My attempt to restore a Unity Project got stuck in Temp so I added ability to disable recursion. I've not yet added as a command-line option so disable by hacking line 119: change "do_recurse=False" to "do_recurse=True".

HTH for future horrified individuals that find themselves here!

from dropbox-restore.

A3003 avatar A3003 commented on June 24, 2024

Hey Arakade,
i tried the script that you provided. i tried that by creating a test folder on dropbox and putting some files in that folder and then deleting them afterwards. Now when i try to restore the files its "Skips" the files. For example i added the files on 6th Dec. deleted them on 9th Dec. now when i run the command with date set to 8th Dec it skips the files where as it should recover the files as the files were there in the folder on 8th. Please help.

from dropbox-restore.

olgageletina avatar olgageletina commented on June 24, 2024

+1 to @A3003's comment, any thoughts @Arakade?

from dropbox-restore.

olgageletina avatar olgageletina commented on June 24, 2024

nvm @A3003 comment out the else clause on line 74 which states that if the files were created before the cut off date don't bother.

from dropbox-restore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.