I have a pickle file in a nested directory inside AWS S3 Bucket, but I'm not able to load it with boto3 library to use it with AWS Lambda.
I've tried to follow the answers to this question, but no one works. This is my code so far:
s3 = boto3.resource('s3')
source_bucket = "source_bucket_name"
key = "folder1/pickle_file.p"
response = s3.Bucket(source_bucket).Object(key).get()
body_string = response['Body'].read()
try:
loaded_pickle = pickle.loads(body_string)
except Exception as e:
print(e)
EDIT
When loading this function into AWS, I'm getting the following error message:
embedded null byte