Dec 16, 2019 · You can use botocore ClientError to catch the exceptions. Something like this: import boto3 from botocore . exceptions import ClientError try : conditionalUpdateResponse = table . put_item ( Item = { 'test' : 'testing20' }, ConditionExpression = 'attribute_exists(test)' ) except ClientError as e : if e . response [ 'Error' ][ 'Code' ] == 'ConditionalCheckFailedException' : print ( e . response [ 'Error' ]) In step 3 of this tutorial, add, modify, and delete data in a DynamoDB table using the AWS SDK for Python (Boto).
import boto3 import argparse from botocore.exceptions import ClientError. client = boto3.client('dynamodb') dynamodb = boto3.resource('dynamodb') def main(): parser = argparse.ArgumentParser(description= 'update evidence bucket names in environment specified.') parser.add_argument('-e', '--env', help='Required environment', required=True) Listing Available AWS Boto3 Exceptions. alexpareto commented on Jul 22, 2019. An ugly, but workable solution to find out what exceptions are available on each client from the command line:
Use these actions to determine the topics contained in your documents, the topics they discuss, the predominant sentiment expressed in them, the predominant language used, and more. import boto3.SystemExit や KeyboardInterrupt は Exception を継承していないため、 except 節に Exception を指定した場合は sys.exit() や割り込みキー入力の例外をキャッチせずそのままプロセスが終了する。