Reading a docx file from s3 bucket with flask results in an AttributeError

import io

import boto3
import docx

BUCKET_NAME = "my-bucket"

def main():
    s3 = boto3.resource("s3")
    bucket = s3.Bucket(BUCKET_NAME)

    object_in_s3 = bucket.Object("test.docx")
    object_as_streaming_body = object_in_s3.get()["Body"]
    print(f"Type of object_as_streaming_body: {type(object_as_streaming_body)}")
    object_as_bytes =
    print(f"Type of object_as_bytes: {type(object_as_bytes)}")

    # Now we use BytesIO to create a file-like object from our byte-stream
    object_as_file_like = io.BytesIO(object_as_bytes)
    # Et voila!
    document = docx.Document(docx=object_as_file_like)


if __name__ == "__main__":
$ python
Type of object_as_streaming_body: 
Type of object_as_bytes: