How to handle exceptions boto3?

Deal with boto3, there is a problem with exception handling boto3. There is a code
import boto3
from botocore.exceptions import NoCredentialsError
s3 = boto3.resource('s3')
 if 's3_bucket_name' not in s3.buckets.all():
 print('S3 bucket not found')
except NoCredentialsError:
 print('Credentials not found')

However, in the absence of Credentials, the program still stupidly ends, throwing botocore.exceptions.NoCredentialsError: Unable to locate credentials. How to solve the problem?
April 19th 20 at 12:16
1 answer
April 19th 20 at 12:18
So maybe s3 = boto3.resource('s3') throws this exception? Always show full traceback, to have more information.
Oh, right... sorry, a piece of code is not completely salmeterol, he threw. - Mateo.Bi commented on April 19th 20 at 12:21
Always show full traceback, to have more information

Why!? There's also a lot of some obscure letters! Guess better your Cup of coffee.
Or put already this Libu, zaregaytes in the Amazon, and guess what would make the author, pereproshit all the configuration options...
Why give the text of the error message? Why is it generally read? The same error message! What's in it for you? There is surely no error is written, and so...

<SARCASM!/> - vinnie commented on April 19th 20 at 12:24

Find more questions by tags Python