aws-tutorial-code icon indicating copy to clipboard operation
aws-tutorial-code copied to clipboard

lambda_textract_detect_text.py has recursion with S3

Open Shyam-Prag opened this issue 2 years ago • 0 comments

This file has the below code which attempts to put the text into a .txt file and sends to the same bucketName which will cause another object to be placed into the same bucket which in turn invokes Lambda again. This bucket name should be changed to a separate bucket to avoid recursion if you want to view the text in .txt file in S3.

           s3.put_object(
                Bucket=bucketname,
                Key=f"output/{filename.split('/')[-1]}_{uuid.uuid4().hex}.txt",
                Body=str("\n".join(raw_text)),
            )

Shyam-Prag avatar Aug 31 '23 23:08 Shyam-Prag