question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to upload empty file?

See original GitHub issue

macOS 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:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found