{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/3685","repository_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/3685/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/3685/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/3685/events","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-python/issues/3685","id":245962487,"number":3685,"title":"Unable to upload empty file?","user":{"login":"danqing","id":5134133,"avatar_url":"https://avatars2.githubusercontent.com/u/5134133?v=4","gravatar_id":"","url":"https://api.github.com/users/danqing","html_url":"https://github.com/danqing","followers_url":"https://api.github.com/users/danqing/followers","following_url":"https://api.github.com/users/danqing/following{/other_user}","gists_url":"https://api.github.com/users/danqing/gists{/gist_id}","starred_url":"https://api.github.com/users/danqing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danqing/subscriptions","organizations_url":"https://api.github.com/users/danqing/orgs","repos_url":"https://api.github.com/users/danqing/repos","events_url":"https://api.github.com/users/danqing/events{/privacy}","received_events_url":"https://api.github.com/users/danqing/received_events","type":"User","site_admin":false},"labels":[{"id":77678602,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/labels/api:%20storage","name":"api: storage","color":"d4af37","default":false},{"id":544604243,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/labels/priority:%20p2+","name":"priority: p2+","color":"ffee58","default":false},{"id":663627407,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/labels/status:%20in%20review","name":"status: in review","color":"fef2c0","default":false},{"id":77438580,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/labels/type:%20bug","name":"type: bug","color":"db4437","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-07-27T08:23:13Z","updated_at":"2017-08-07T17:29:46Z","closed_at":"2017-08-07T17:13:14Z","body":"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!"},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/comments/320727920","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-python/issues/3685#issuecomment-320727920","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/3685","id":320727920,"user":{"login":"danqing","id":5134133,"avatar_url":"https://avatars2.githubusercontent.com/u/5134133?v=4","gravatar_id":"","url":"https://api.github.com/users/danqing","html_url":"https://github.com/danqing","followers_url":"https://api.github.com/users/danqing/followers","following_url":"https://api.github.com/users/danqing/following{/other_user}","gists_url":"https://api.github.com/users/danqing/gists{/gist_id}","starred_url":"https://api.github.com/users/danqing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danqing/subscriptions","organizations_url":"https://api.github.com/users/danqing/orgs","repos_url":"https://api.github.com/users/danqing/repos","events_url":"https://api.github.com/users/danqing/events{/privacy}","received_events_url":"https://api.github.com/users/danqing/received_events","type":"User","site_admin":false},"created_at":"2017-08-07T17:29:46Z","updated_at":"2017-08-07T17:29:46Z","body":"I see. Thanks @dhermes ! I've already implemented a workaround - will wait until 0.2.3 to get rid of it :)"}}
{"actor":{"display_login":"danqing"}}