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

Uploading heavy files to gdrive fails with httplib2.error.RedirectMissingLocation raised by googleapiclient #1

Closed
annapods opened this issue Nov 23, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@annapods
Copy link
Owner

When trying to upload a heavy file (112Mo) to google drive, process freezes for a while then throws the following error:

Uploading podfic files to gdrive...
../../../Musique/2.5 to post/ow - mdlv/[OW] Mémoire de la Veuve.mp3
Traceback (most recent call last):
  File "main.py", line 56, in <module>
    gdrive_uploader.upload_audio()
  File "/home/pod/Documents/code/html generator/gdrive_uploader.py", line 52, in upload_audio
    self.upload_file(path)
  File "/home/pod/Documents/code/html generator/gdrive_uploader.py", line 79, in upload_file
    file.Upload()
  File "/home/pod/Documents/code/html generator/.venv/lib/python3.7/site-packages/pydrive/files.py", line 285, in Upload
    self._FilesInsert(param=param)
  File "/home/pod/Documents/code/html generator/.venv/lib/python3.7/site-packages/pydrive/auth.py", line 75, in _decorated
    return decoratee(self, *args, **kwargs)
  File "/home/pod/Documents/code/html generator/.venv/lib/python3.7/site-packages/pydrive/files.py", line 369, in _FilesInsert
    http=self.http)
  File "/home/pod/Documents/code/html generator/.venv/lib/python3.7/site-packages/googleapiclient/_helpers.py", line 131, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/home/pod/Documents/code/html generator/.venv/lib/python3.7/site-packages/googleapiclient/http.py", line 901, in execute
    _, body = self.next_chunk(http=http, num_retries=num_retries)
  File "/home/pod/Documents/code/html generator/.venv/lib/python3.7/site-packages/googleapiclient/_helpers.py", line 131, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/home/pod/Documents/code/html generator/.venv/lib/python3.7/site-packages/googleapiclient/http.py", line 1084, in next_chunk
    self.resumable_uri, method="PUT", body=data, headers=headers
  File "/home/pod/Documents/code/html generator/.venv/lib/python3.7/site-packages/oauth2client/transport.py", line 175, in new_request
    redirections, connection_type)
  File "/home/pod/Documents/code/html generator/.venv/lib/python3.7/site-packages/oauth2client/transport.py", line 282, in request
    connection_type=connection_type)
  File "/home/pod/Documents/code/html generator/.venv/lib/python3.7/site-packages/httplib2/__init__.py", line 1702, in request
    conn, authority, uri, request_uri, method, body, headers, redirections, cachekey,
  File "/home/pod/Documents/code/html generator/.venv/lib/python3.7/site-packages/httplib2/__init__.py", line 1445, in _request
    _("Redirected but the response is missing a Location: header."), response, content,
httplib2.error.RedirectMissingLocation: Redirected but the response is missing a Location: header.

First reference to a similar issue: #googlearchive/PyDrive#27
A potential fix by pinning the versions of the underlying APIs (didn't work): #googleapis/google-api-python-client#803
2021 deprecation notice for pydrive: #googlearchive/PyDrive@42022f9

Proposed solution: switch to pydrive2, which is actively maintained.

@annapods annapods self-assigned this Nov 23, 2022
@annapods annapods added the bug Something isn't working label Nov 23, 2022
@annapods
Copy link
Owner Author

annapods commented Dec 2, 2022

Fixed, see #a9a32f3

@annapods annapods closed this as completed Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant