Azure / Azure/azure-storage-python

create_blob_from_stream does not support string stream (StringIO or file in text mode)

Aperta
#546 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
343
Fork
243
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### 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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.