Title: Blob.upload_from_file doesn't work for file-like objects without size parameter · Issue #900 · googleapis/google-cloud-python · GitHub
Open Graph Title: Blob.upload_from_file doesn't work for file-like objects without size parameter · Issue #900 · googleapis/google-cloud-python
X Title: Blob.upload_from_file doesn't work for file-like objects without size parameter · Issue #900 · googleapis/google-cloud-python
Description: When using StringIO, io.BytesIO or other file-like objects (such as Flask/werkzeug's file upload object), trying to upload via Blob.upload_from_file doesn't work because it attempts to find the size of the object using os.stat throwing a...
Open Graph Description: When using StringIO, io.BytesIO or other file-like objects (such as Flask/werkzeug's file upload object), trying to upload via Blob.upload_from_file doesn't work because it attempts to find the siz...
X Description: When using StringIO, io.BytesIO or other file-like objects (such as Flask/werkzeug's file upload object), trying to upload via Blob.upload_from_file doesn't work because it attempts to find...
Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/900
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Blob.upload_from_file doesn't work for file-like objects without size parameter","articleBody":"When using `StringIO`, `io.BytesIO` or other file-like objects (such as Flask/werkzeug's file upload object), trying to upload via `Blob.upload_from_file` doesn't work because it attempts to find the size of the object using `os.stat` throwing a `AttributeError: StringIO instance has no attribute 'fileno'`. Passing in the size manually fixes this, but imo this inconsistency shouldn't burden the user as there are other ways than fileno to determine the size of a StringIO or io.BytesIO instance (`seek`, `tell`).\n\nAt any rate, the error message could be more helpful.\n","author":{"url":"https://github.com/theacodes","@type":"Person","name":"theacodes"},"datePublished":"2015-05-28T20:48:25.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/900/google-cloud-python/issues/900"}
| 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:d74a31a4-e6be-9ab4-3ec2-78b5e0870c22 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DC98:380D9A:45910:5E9BD:6A4D7DAC |
| html-safe-nonce | e70f7ef52719f2944f65c29434fe9ebf27e2fa9ab9806c246fe0debc2808398c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQzk4OjM4MEQ5QTo0NTkxMDo1RTlCRDo2QTREN0RBQyIsInZpc2l0b3JfaWQiOiI4MjA2MDY3ODQxNTQ5MzAzMjEyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 097b486aa1ec2b44403e19c2bb6bdc83d9d488f2296f046c3024f08388cd4ba7 |
| hovercard-subject-tag | issue:82117849 |
| 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/900/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dba15295164388c7fc916e7ae6c5b3d4b4f1eaaa6279b9fe66b0f7d3895a00ad/googleapis/google-cloud-python/issues/900 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dba15295164388c7fc916e7ae6c5b3d4b4f1eaaa6279b9fe66b0f7d3895a00ad/googleapis/google-cloud-python/issues/900 |
| og:image:alt | When using StringIO, io.BytesIO or other file-like objects (such as Flask/werkzeug's file upload object), trying to upload via Blob.upload_from_file doesn't work because it attempts to find the siz... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | theacodes |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7f8e15305e2ab58890ca84b830615e375f5df303cf471cafcba0c08272981be3 |
| 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 | 8608b0750fc35e283e5ec5b094bff942d7a0e197 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width