AttributeError: module 'botocore' has no attribute 'session' when following the boto3 quickstart

Viewed 4223

I was following the boto3 quickstart instructions and I can run import boto3, but when I try to execute any basic command like db = boto3.resource('dynamodb') I get

Traceback (most recent call last):

  File "<ipython-input-144-424c27c1bae1>", line 1, in <module>
    botocore.session.get_session()

AttributeError: module 'botocore' has no attribute 'session'

The credentials and config files look good and i tried to reinstall awscli and boto3 but is not helping. I don't understand what is the issue.

2 Answers

Not sure why this does not work.

import boto3

boto3.resource('dynamodb')

But this works.

from botocore.session import Session

session = Session()
session.create_client("ec2", aws_access_key_id=<access_key_id>, aws_secret_access_key=<secret_access_key>)

Related