joao pereira
joao pereira

Reputation: 65

Cant create s3 session

i am trying to download some data from our s3 server and im not being able to create the session.

i am running the following code:

session = boto3.Session(
    aws_access_key_id = "###########",
    aws_secret_access_key = "###########",
)

s3 = session.resource('s3')
bucket = s3.Bucket('########')
file_names = []

but it spits out the following error:

DataNotFoundError: Unable to load data for: sdk-default-configuration

These are my imports:

import pandas as pd
import mysql.connector
import boto3
import s3fs
import botocore
import pandas as pd
import os

and my versions of boto3 and botocore installed are boto3-1.20.44 and botocore-1.23.44

I have tried downloading different versions of boto3 and botocore with no success...

Upvotes: 1

Views: 1573

Answers (1)

jarmod
jarmod

Reputation: 78553

The problem appears to be in your session constructor:

boto3.Session(aws_access_key_id=a, aws_secret_access_key=b)

It should instead read as follows, per the documentation:

boto3.session.Session(aws_access_key_id=a, aws_secret_access_key=b)

Upvotes: 0

Related Questions