You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So now I'm trying to download an encrypted file, and I figured I'd pipe it through the StreamDecryptor. But when I try this, I get back
TypeError: 'StreamingBody' does not have the buffer interface
I suspect this is because in def prep_stream_data(data): (L138:internal/utils/__init__.py), my file like object is checked with isinstance(data, (file, io.IOBase, six.StringIO)). But my object is a botocore StreamingBody, which doesn't inherit from any of these. So my object gets passed to io.BytesIO and dies because it's a stream and not a buffer.
I'm not sure what this check is specifically requiring, it might be nicer to check for specific methods -- I expected anything with read() to work here.
The text was updated successfully, but these errors were encountered:
Redoubts
changed the title
'StreamingBody' does not have the buffer interface
Can't pass an object with read() to StreamDecryptor
Aug 29, 2018
I think the simplest solution to this is to invert what prep_stream_data is doing and rather than pass through stuff that matches a certain pattern, instead pass through anything that is not a string or bytes, and cast/wrap those.
We'll probably want to change this in the future to be more prescriptive, but before that I'll want to properly define what API we expect source streams to have and expose a helper to check that.
So now I'm trying to download an encrypted file, and I figured I'd pipe it through the
StreamDecryptor
. But when I try this, I get backTypeError: 'StreamingBody' does not have the buffer interface
I suspect this is because in
def prep_stream_data(data):
(L138:internal/utils/__init__.py), my file like object is checked withisinstance(data, (file, io.IOBase, six.StringIO))
. But my object is a botocoreStreamingBody
, which doesn't inherit from any of these. So my object gets passed to io.BytesIO and dies because it's a stream and not a buffer.I'm not sure what this check is specifically requiring, it might be nicer to check for specific methods -- I expected anything with
read()
to work here.The text was updated successfully, but these errors were encountered: