Azure / Azure/azure-storage-python
create_blob_from_stream does not support string stream (StringIO or file in text mode)
- Dominant language
- Python
- Stars
- 343
- Forks
- 243
- PR merge metrics
- No merged PRs in 30d
Description
### Which service(blob, file, queue) does this issue concern?
blob
### Which version of the SDK was used? Please provide the output of `pip freeze`.
Azure 4.0.0, blob 1.4.0
### What problem was encountered?
`create_blob_from_stream` says it supports `io.IOBase`, however it only supports bytes stream, not string/plain text stream or file.
Relevant function and error raised
```
def _get_data_bytes_only(param_name, param_value):
'''Validates the request body passed in and converts it to bytes
if our policy allows it.'''
if param_value is None:
return b''
if isinstance(param_value, bytes):
return param_value
> raise TypeError(_ERROR_VALUE_SHOULD_BE_BYTES.format(param_name))
E TypeError: foobar should be of type bytes.
```
### Have you found a mitigation/solution?
No.
Note: for table service, please post the issue here instead: https://github.com/Azure/azure-cosmosdb-python.
Contributor guide
Assessment
This issue has not been assessed yet.