My code is throwing:
botocore.errorfactory.BatchEntryIdsNotDistinct: An error occurred (AWS.SimpleQueueService.BatchEntryIdsNotDistinct) when calling the DeleteMessageBatch operation: Id 85990c40-xxxx-43f5-a66e-80618a734157 repeated.
I would like to catch the exception, but can't import it:
from botocore.errorfactory import BatchEntryIdsNotDistinct
ImportError: cannot import name 'BatchEntryIdsNotDistinct' from 'botocore.errorfactory'
It doesn't even seem to exist as python code, just as json:
grep -r BatchEntryIdsNotDistinct .
./lib/python3.9/site-packages/botocore/data/sns/2010-03-31/service-2.json: {"shape":"BatchEntryIdsNotDistinctException"},
./lib/python3.9/site-packages/botocore/data/sns/2010-03-31/service-2.json: "BatchEntryIdsNotDistinctException":{
./lib/python3.9/site-packages/botocore/data/sns/2010-03-31/service-2.json: "code":"BatchEntryIdsNotDistinct",
./lib/python3.9/site-packages/botocore/data/sqs/2012-11-05/service-2.json: {"shape":"BatchEntryIdsNotDistinct"},
./lib/python3.9/site-packages/botocore/data/sqs/2012-11-05/service-2.json: {"shape":"BatchEntryIdsNotDistinct"},
./lib/python3.9/site-packages/botocore/data/sqs/2012-11-05/service-2.json: {"shape":"BatchEntryIdsNotDistinct"},
./lib/python3.9/site-packages/botocore/data/sqs/2012-11-05/service-2.json: "BatchEntryIdsNotDistinct":{
./lib/python3.9/site-packages/botocore/data/sqs/2012-11-05/service-2.json: "code":"AWS.SimpleQueueService.BatchEntryIdsNotDistinct",
This is my code (shortened):
sqs = boto3.resource('sqs', region_name='us-west-2')
queue = sqs.get_queue_by_name(QueueName=<queue name here>)
queue.delete_messages(Entries=<messages to delete>)
Where do I get the exception BatchEntryIdsNotDistinct
from to catch it?