Title: Unable to upload empty file? · Issue #3685 · googleapis/google-cloud-python · GitHub
Open Graph Title: Unable to upload empty file? · Issue #3685 · googleapis/google-cloud-python
X Title: Unable to upload empty file? · Issue #3685 · googleapis/google-cloud-python
Description: 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_typ...
Open Graph Description: 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_filenam...
X Description: 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_filenam...
Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/3685
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unable to upload empty file?","articleBody":"macOS 10.12.6, Python 3.6.2, google-cloud-storage 1.2.0.\r\n\r\nIt seems that if a file is empty, I cannot upload it:\r\n\r\n```py\r\nblob = storage.Blob(dest_filename, bucket, chunk_size=262144)\r\nblob.upload_from_filename(src_filename, content_type=content_type)\r\n```\r\n\r\nError:\r\n\r\n```py\r\nFile \"storage.py\", line 88, in upload_from_file\r\n blob.upload_from_filename(src_filename, content_type=content_type)\r\nFile \"app/env/lib/python3.6/site-packages/google/cloud/storage/blob.py\", line 934, in upload_from_filename\r\n size=total_bytes)\r\nFile \"app/env/lib/python3.6/site-packages/google/cloud/storage/blob.py\", line 891, in upload_from_file\r\n client, file_obj, content_type, size, num_retries)\r\nFile \"app/env/lib/python3.6/site-packages/google/cloud/storage/blob.py\", line 818, in _do_upload\r\n client, stream, content_type, size, num_retries)\r\nFile \"app/env/lib/python3.6/site-packages/google/cloud/storage/blob.py\", line 771, in _do_resumable_upload\r\n response = upload.transmit_next_chunk(transport)\r\nFile \"app/env/lib/python3.6/site-packages/google/resumable_media/requests/upload.py\", line 392, in transmit_next_chunk\r\n method, url, payload, headers = self._prepare_request()\r\nFile \"app/env/lib/python3.6/site-packages/google/resumable_media/_upload.py\", line 531, in _prepare_request\r\n self._stream, self._chunk_size, self._total_bytes)\r\nFile \"app/env/lib/python3.6/site-packages/google/resumable_media/_upload.py\", line 805, in get_next_chunk\r\n u'Stream is already exhausted. There is no content remaining.')\r\nValueError: Stream is already exhausted. There is no content remaining.\r\n```\r\n\r\nWhen 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?\r\n\r\nThanks!","author":{"url":"https://github.com/danqing","@type":"Person","name":"danqing"},"datePublished":"2017-07-27T08:23:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/3685/google-cloud-python/issues/3685"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b13ef6af-e325-9b02-5623-24fcd23a16d9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D4C2:34E523:11A4FEF:1800E56:6A4D6B3A |
| html-safe-nonce | 5b308c473efac0775134734ac957585e01ddf9eeaeea17c002e09f151f60d0d4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENEMyOjM0RTUyMzoxMUE0RkVGOjE4MDBFNTY6NkE0RDZCM0EiLCJ2aXNpdG9yX2lkIjoiNTk2MzkxOTIyMzEwNTA4ODMxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1037e99006dff29889a0e9f5554b08dae40c8bf1876544c4846d51e218055552 |
| hovercard-subject-tag | issue:245962487 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-python/3685/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a5c300bf64b1fc4c9a7ebabfc8146ad3adb8201154984090dac91f612effa717/googleapis/google-cloud-python/issues/3685 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a5c300bf64b1fc4c9a7ebabfc8146ad3adb8201154984090dac91f612effa717/googleapis/google-cloud-python/issues/3685 |
| og:image:alt | 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_filenam... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | danqing |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7db3950e3f59095e20a9789440c3dd554efc62d434882ead06ae05b5815605b9 |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/google-cloud-python git https://github.com/googleapis/google-cloud-python.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 16316451 |
| octolytics-dimension-repository_nwo | googleapis/google-cloud-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 16316451 |
| octolytics-dimension-repository_network_root_nwo | googleapis/google-cloud-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cd8f6a71db61d6012a0cbb134be844fdbe9b8a45 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width