botostubs
botostubs copied to clipboard
Error Cannot access member "client" for type "ClientMeta"
Hi!
I'm using botostubs to facilitate learning in the boto3 API.
While using it, I tested a code provided by the boto3 documentation itself and had the following error:

Any attempt to use exceptions with s3 botostubs fails.
Am I doing something wrong?
Here is the code:
import boto3
import botostubs
s3 = boto3.client('s3') #type: botostubs.S3
try:
s3.create_bucket(Bucket='sdkpython')
except s3.meta.client.exceptions.BucketAlreadyExists as err:
print("Bucket already exists!".format(err.response['Error']['Bucket']))
raise err
Thanks!
Thanks for reporting this and being a botostubs user. You probably did it right but I think you'd get the problem without botostubs. Can you confirm that for me? This is because exceptions, like most classes, are runtime classes in boto3
Still, it may still be addressable in botostubs. I'll see if I can work on this tonight otherwise it will have to wait.
Hello!
Thank you for your help!
I got the code exactly as in the boto3 documentation (https://boto3.amazonaws.com/v1/documentation/api/latest/guide/error-handling.html)
I did two tests. The first has a bucket name exists and the other does not. Follow the prints and the code at the end.
First test:

Second test:

import boto3
import botostubs
client = boto3.client('s3') #type: botostubs.S3
try:
client.create_bucket(Bucket='icaroaws')
except client.meta.client.exceptions.BucketAlreadyExists as err:
print("Bucket {} already exists!".format(err.response['Error']['BucketName']))
raise err