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

The root folder is unsupported #567

Closed
pwierzgala opened this issue Aug 25, 2018 · 3 comments
Closed

The root folder is unsupported #567

pwierzgala opened this issue Aug 25, 2018 · 3 comments
Labels

Comments

@pwierzgala
Copy link

I run the following code:

from django.core.management import call_command

def create_db_backup():
    call_command('dbbackup', compress=True, clean=True)

the backup creates and is uploaded to my dropbox account but at the end I get the following error:

[2018-08-25 17:18:13,416: INFO/ForkPoolWorker-2] Writing file to default-2018-08-25-17-17-50.psql.gz
[2018-08-25 17:18:13,417: INFO/ForkPoolWorker-2] Request to files/get_metadata
[2018-08-25 17:18:13,951: INFO/ForkPoolWorker-2] Request to files/upload_session/start
[2018-08-25 17:18:32,623: INFO/ForkPoolWorker-2] Request to files/upload_session/append_v2
[2018-08-25 17:18:50,764: INFO/ForkPoolWorker-2] Request to files/upload_session/append_v2
[2018-08-25 17:21:52,031: INFO/ForkPoolWorker-2] Request to files/upload_session/finish
[2018-08-25 17:21:54,395: INFO/ForkPoolWorker-2] Request to files/get_metadata
BadInputError: BadInputError('d8e906319f920d75ffc769f3fe86fba4', 'Error in call to API function "files/get_metadata": request body: path: The root folder is unsupported.')

If I set any directory in root_path of DBBACKUP_STORAGE_OPTIONS, e.g.:

DBBACKUP_STORAGE_OPTIONS = {
    'oauth2_access_token': 'token',
    'root_path': '/dir/'
}

then the error changes to: TypeError: 'FolderMetadata' object is not subscriptable. The same as in the issue: #396

Do you have any idea what may be wrong? Below I enclose information about my configuration.

Requirements:

dropbox==9.0.0
django-dbbackup==3.2.0
django-storages==1.6.6

Settings:

DBBACKUP_STORAGE = 'storages.backends.dropbox.DropBoxStorage'
DBBACKUP_STORAGE_OPTIONS = {
    'oauth2_access_token': 'token'
}
@sww314 sww314 added the dropbox label Aug 27, 2018
@matburnham
Copy link

I get a similar issue, when trying to use django-dbbackup's dbrestore or listbackups commands.

Digging a little, it's probably something to do with Apps sandboxing, but difficult to figure out.

$ ./manage.py shell
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from storages.backends.dropbox import DropBoxStorage
>>> DROPBOX_OAUTH2_TOKEN = '[my token]'
>>> d = DropBoxStorage(DROPBOX_OAUTH2_TOKEN)

>>> d.listdir()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
TypeError: listdir() missing 1 required positional argument: 'path'

>>> d.listdir('')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/mat/.virtualenvs/flyuk/lib/python3.6/site-packages/storages/backends/dropbox.py", line 81, in listdir
    metadata = self.client.files_get_metadata(full_path)
  File "/home/mat/.virtualenvs/flyuk/lib/python3.6/site-packages/dropbox/base.py", line 1243, in files_get_metadata
    None,
  File "/home/mat/.virtualenvs/flyuk/lib/python3.6/site-packages/dropbox/dropbox.py", line 274, in request
    timeout=timeout)
  File "/home/mat/.virtualenvs/flyuk/lib/python3.6/site-packages/dropbox/dropbox.py", line 365, in request_json_string_with_retry
    timeout=timeout)
  File "/home/mat/.virtualenvs/flyuk/lib/python3.6/site-packages/dropbox/dropbox.py", line 456, in request_json_string
    raise BadInputError(request_id, r.text)
dropbox.exceptions.BadInputError: BadInputError('...', 'Error in call to API function "files/get_metadata": request body: path: The root folder is unsupported.')

>>> d.listdir('/')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/mat/.virtualenvs/flyuk/lib/python3.6/site-packages/storages/backends/dropbox.py", line 81, in listdir
    metadata = self.client.files_get_metadata(full_path)
  File "/home/mat/.virtualenvs/flyuk/lib/python3.6/site-packages/dropbox/base.py", line 1243, in files_get_metadata
    None,
  File "/home/mat/.virtualenvs/flyuk/lib/python3.6/site-packages/dropbox/dropbox.py", line 274, in request
    timeout=timeout)
  File "/home/mat/.virtualenvs/flyuk/lib/python3.6/site-packages/dropbox/dropbox.py", line 365, in request_json_string_with_retry
    timeout=timeout)
  File "/home/mat/.virtualenvs/flyuk/lib/python3.6/site-packages/dropbox/dropbox.py", line 456, in request_json_string
    raise BadInputError(request_id, r.text)
dropbox.exceptions.BadInputError: BadInputError('...', 'Error in call to API function "files/get_metadata": request body: path: The root folder is unsupported.')

>>> d.listdir('/Apps')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/mat/.virtualenvs/flyuk/lib/python3.6/site-packages/storages/backends/dropbox.py", line 81, in listdir
    metadata = self.client.files_get_metadata(full_path)
  File "/home/mat/.virtualenvs/flyuk/lib/python3.6/site-packages/dropbox/base.py", line 1243, in files_get_metadata
    None,
  File "/home/mat/.virtualenvs/flyuk/lib/python3.6/site-packages/dropbox/dropbox.py", line 296, in request
    user_message_locale)
dropbox.exceptions.ApiError: ApiError('...', GetMetadataError('path', LookupError('not_found', None)))

>>> d.listdir('/Test')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/mat/.virtualenvs/flyuk/lib/python3.6/site-packages/storages/backends/dropbox.py", line 82, in listdir
    for entry in metadata['contents']:
TypeError: 'FolderMetadata' object is not subscriptable

Any ideas?

@matburnham
Copy link

Okay, looks like #402 fixes this, amongst other things.

@jschneier
Copy link
Owner

Fixed by #724.

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

No branches or pull requests

4 participants