Unable to upload empty file?
See original GitHub issuemacOS 10.12.6, Python 3.6.2, google-cloud-storage 1.2.0.
It seems that if a file is empty, I cannot upload it:
blob = storage.Blob(dest_filename, bucket, chunk_size=262144)
blob.upload_from_filename(src_filename, content_type=content_type)
Error:
File "storage.py", line 88, in upload_from_file
blob.upload_from_filename(src_filename, content_type=content_type)
File "app/env/lib/python3.6/site-packages/google/cloud/storage/blob.py", line 934, in upload_from_filename
size=total_bytes)
File "app/env/lib/python3.6/site-packages/google/cloud/storage/blob.py", line 891, in upload_from_file
client, file_obj, content_type, size, num_retries)
File "app/env/lib/python3.6/site-packages/google/cloud/storage/blob.py", line 818, in _do_upload
client, stream, content_type, size, num_retries)
File "app/env/lib/python3.6/site-packages/google/cloud/storage/blob.py", line 771, in _do_resumable_upload
response = upload.transmit_next_chunk(transport)
File "app/env/lib/python3.6/site-packages/google/resumable_media/requests/upload.py", line 392, in transmit_next_chunk
method, url, payload, headers = self._prepare_request()
File "app/env/lib/python3.6/site-packages/google/resumable_media/_upload.py", line 531, in _prepare_request
self._stream, self._chunk_size, self._total_bytes)
File "app/env/lib/python3.6/site-packages/google/resumable_media/_upload.py", line 805, in get_next_chunk
u'Stream is already exhausted. There is no content remaining.')
ValueError: Stream is already exhausted. There is no content remaining.
When uploading a folder, it’d be ideal if I don’t need to check whether a file is empty before uploading. Or am I doing something wrong?
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
'Empty files cannot be uploaded' - Dropbox Community
Unable to upload 1.2020.9.1.ver. Empty files cannot be uploaded. I get this message when trying to upload this file or any to dropbox....
Read more >Solved: Dropbox Can't Upload Empty Folders in Chrome Error
Quick fixes to Dropbox can't upload empty folder · Fix 1. Clear your browser caches · Fix 2. Try the incognito mode ·...
Read more >Unable to upload empty files ("The submitted file is empty") #317
The files page in the submission system blocks the user from uploading empty files and displays a "the submitted file is empty" message....
Read more >Upload error: you cannot upload empty files - SAP Community
Hi, I'm trying to upload a simple file (MyFile.gif), but when I click "Upload" I receive an error mesage. The procedure: - select:...
Read more >Uploading Empty Files - Strava Support
This error is generated when there is no GPS data in the file you are attempting to upload. This happens primarily for two...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Blerg, the release build https://circleci.com/gh/GoogleCloudPlatform/google-resumable-media-python/189 collided with a different build https://circleci.com/gh/GoogleCloudPlatform/google-resumable-media-python/188 and made some flaky failures.
Hopefully https://circleci.com/gh/GoogleCloudPlatform/google-resumable-media-python/190 will actually succeed and push the release to PyPI
https://pypi.org/project/google-cloud-storage/1.3.1/ exists now (in addition to https://pypi.org/project/google-resumable-media/0.2.3/)