Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script stops with a 404 dropbox rest error on some files #16

Open
1000mb opened this issue Jun 8, 2014 · 9 comments
Open

Script stops with a 404 dropbox rest error on some files #16

1000mb opened this issue Jun 8, 2014 · 9 comments

Comments

@1000mb
Copy link

1000mb commented Jun 8, 2014

dropbox.rest.ErrorResponse: [404] u"Path XXXXXX not found

I worked round this by wrapping:
if item.get('is_dir', False):
restore_folder(client, item['path'], cutoff_datetime, verbose)
else:
restore_file(client, item['path'], cutoff_datetime,
item.get('is_deleted', False), verbose)
(lines 81 to 85)
in a try, catch block so that these files would be skipped and the restore continue.

@clark800
Copy link
Owner

clark800 commented Jun 9, 2014

Can you provide any additional information about what caused the error? Putting a try/except around this code is probably not the best way to address this issue, so I would need to reproduce the issue to find the source of the problem.

@NgJason
Copy link

NgJason commented Jun 19, 2014

I am also having this problem, Im running this in lubuntu, with version python 2.7.4,
do I do it like this?:

try:
if item.get('is_dir', False):
restore_folder(client, item['path'], cutoff_datetime, verbose)
else:
restore_file(client, item['path'], cutoff_datetime,
item.get('is_deleted', False), verbose)
time.sleep(DELAY)
else:

how can I fix it? it seems like its not able to find any files

@1000mb
Copy link
Author

1000mb commented Jun 20, 2014

I was hoping to have some spare time to spend on this and getting into github bit it seems this is not to be, at least for now.
https://dl.dropboxusercontent.com/u/1630910/restore.py
This is a slightly modified version with the try/except block in place. As noted by clark, this is a horrible hack. Also NB, there are no app keys in this file!

I should also point out that when I ran into this problem it only affected maybe 20 out of 90,000+ files. Certainly not everything in dropbox!

I'll also just mention that I actually ended up modifying that try/except to catch all errors as I ran into a couple of files (that I didn't need) that had non ascii characters in their names which produced another error.

Sorry about all the hacks but I was helping someone recover from one of those ransomware viruses and time was of the essence. Also now they are recovered I don't have access to the dropbox account that produced these errors so there isn't much more I can do to help.

@NgJason
Copy link

NgJason commented Jun 20, 2014

Thanks. Im going to try them this evening. Do you know of a way to try this on windows? This is my current situation:
A lot of files were deleted in dropbox/stuff/ 2 months ago. This is a windows os.

Since the commands were written for linux, i am running a lubutu os in virtualbox and downloaded dropbox on lubuntu with the same account. It is now synced to the current windows dropbox folder.

Then i open terminal and cd my way to restore script and i type the python commad provided on the first page.

Ive only tried 2 folders (i dont want to mess everything up)
With parameter /a \for dropbox folder dropbox/a/
and it returns
:restoring a
Error 404 i forgot the rest of the message

am i doing everything correct on my end? Ive only dealt with linux os for a month.

Thanks for your time!

@NgJason
Copy link

NgJason commented Jun 20, 2014

I tried your version, but I am still getting this error:
user@user-VirtualBox:/media/sf_a$ python2.7 restore.py /hi 2014-06-09
Restoring folder: /hi
[404] u"Path '/hi' not found"
Note: You must specify the path starting with "/", where "/" is the root
of your dropbox folder. So if your dropbox directory is at "/home/user/dropbox"
and you want to restore "/home/user/dropbox/folder", the ROOTPATH is "/folder".

@bloemy7
Copy link

bloemy7 commented Feb 9, 2015

I am getting the same error. No solution?

@clark800
Copy link
Owner

I can't reproduce this, so there's no way to debug it. Please provide as much information as you can so that someone can figure it out at some point.

@dtb
Copy link

dtb commented May 2, 2015

I ran into this with a shared folder, idk if that helps.

Here was the stack

Traceback (most recent call last):
  File "restore.py", line 103, in <module>
    main()
  File "restore.py", line 99, in main
    restore_folder(client, root_path, cutoff_datetime, verbose=True)
  File "restore.py", line 84, in restore_folder
    restore_folder(client, item['path'], cutoff_datetime, verbose)
  File "restore.py", line 84, in restore_folder
    restore_folder(client, item['path'], cutoff_datetime, verbose)
  File "restore.py", line 87, in restore_folder
    item.get('is_deleted', False), verbose)
  File "restore.py", line 47, in restore_file
    revisions = client.revisions(path.encode('utf8'))
  File "/Library/Python/2.7/site-packages/dropbox/client.py", line 1041, in revisions
    return self.rest_client.GET(url, headers)
  File "/Library/Python/2.7/site-packages/dropbox/rest.py", line 311, in GET
    return cls.IMPL.GET(*n, **kw)
  File "/Library/Python/2.7/site-packages/dropbox/rest.py", line 246, in GET
    return self.request("GET", url, headers=headers, raw_response=raw_response)
  File "/Library/Python/2.7/site-packages/dropbox/rest.py", line 227, in request
    raise ErrorResponse(r, r.read())
dropbox.rest.ErrorResponse: [404] u"Path '/some/shared/folder/file.jpg' not found"

Also the file was super old, but it had just barely been added to my dropbox today. Maybe revision history works different for shared folders or something?

Thanks so much for this script!

@jcvikl
Copy link

jcvikl commented Aug 3, 2016

this is my experience:
-- if you have free dropbox account insert into restore.py line 104 "cutoff_datetime).days >= 30", if you have pro dropbox account insert "cutoff_datetime).days >= 365"
-- if you get error - script stops with a 404 dropbox rest error on some files like dropbox.rest.ErrorResponse: [404] u"Path '/some/shared/folder/file.jpg' not found" REPEAT COMMAND FOR SAME DIRECTORY python2.7 restore.py /folder/../ 2016-06-25
Many times script goes through, seems Dropbox or our server has capacity problems!!!!

  • I got error many times as: ..."Path '/hi 2' not found" Note: You must specify the path starting with "/", where "/" is the root of your dropbox folder. So if your dropbox directory is at "/home/user/dropbox" and you want to restore "/home/user/dropbox/folder", the ROOTPATH is "/folder".
    I help myself to define names as they have blank space so I insert into command
    python2.7 restore.py /folder/My Documents/ 2016-06-25
    blank space linux command:
    python2.7 restore.py /folder/"My Documents"/ 2016-06-25
    so you can solve blank spaces with "Folder name"
    -- i run restore 2 times by folder for sure.

APPENDIX: If you need help contact me over http://marcelino.si because many newcomer havent root server access.

Have a nice day, bye

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants