[PYTHON] If you get a no attribute error in boto3, check the version

boto3 error

When I used put_function_event_invoke_config of boto3,

import botocore
import boto3

client = boto3.client('lambda')
response = client.put_function_event_invoke_config(
    FunctionName=FunctionName,
    MaximumRetryAttempts=0,
)

The following error occurs

AttributeError: 'Lambda' object has no attribute 'put_function_event_invoke_config'

When translated

AttributeError: The'Lambda'object does not have the'put_function_event_invoke_config' attribute.

And that.

I added the following to lambda and confirmed the versions of boto3 and botocore.

    print('botocore vertion is {0}'.format(botocore.__version__))
    print('boto3 vertion is {0}'.format(boto3.__version__))

This is the result

botocore vertion is 1.12.253
boto3 vertion is 1.14.57

I checked the current version below ... Releases · boto/boto3 · GitHub Releases · boto/botocore · GitHub

botocore seems to be more than half a year old.

Update botocore

You can update it according to the following article.

[[AWS] How to use boto on Lambda and how to use the latest boto](https://bbh.bz/2019/11/10/how-to-use-latest-ver-boto-at-lambda/#boto -3)

In the case of Serverless Framework, it can be updated by inserting the serverless-python-requirements plugin and adding boto3 and botocore to requirement.txt.

The following articles will be helpful. [Tips] Deploy Lambda Layer with the latest boto3 installed with Serverless Framework

Solution

By updating botocore, the error has been resolved.

reference

Recommended Posts

If you get a no attribute error in boto3, check the version
What to do if you get a "No versions found" error in pipenv
If you get a Programming Error: (1146, "Table'<table name>' doesn't exist") in Django
[Python] What to check when you get a Unicode Decode Error in Django
What to do if a version error occurs in the selenium Chrome driver
Check if the string is a number in python
If you encounter a "Unicode Decode Error" in Python
What to do if you get Swagger-codegen in python and Import Error: No module named
Solution if the module is installed in Python but you get an error in Jupyter notebook
What to do if you get a Cannot retrieve metalink for repository error in yum
If you get Error: That port is already in use. In Django
What to do if you get a minus zero in Python
Check if you can connect to a TCP port in Python
What to do if you get a must override `get_config` error when trying to model.save in Keras
Check if the URL exists in Python
If you want a singleton in python, think of the module as a singleton
I get a Python No module named'encodings' error with the aws command
Check if there is a specific symbol in the executable file and its dependent libraries (simplified version)
What to do if you get an error when trying to send a message in tasks.loop () immediately after startup
[Python] Get the files in a folder with Python
When I get a chromedriver error in Selenium
A solution if you accidentally remove the python interpreter in / usr / local / bin /.
Check if the characters are similar in Python
In the Chainer tutorial, I get an error when importing a package. (mock)
What to do if you get the error Input contains NaN, infinity or a value too large for dtype ('float64'). In machine learning
Get the caller of a function in Python
If you guys in the scope kitchen can do it with a margin ~ ♪
The first thing to check when a No Reverse Match occurs in Django
What to do if you get the error RuntimeError: Python is not installed as a framework when trying to use matplitlib and pylab in Python 3.3
If you get a long error when tabbing an interactive shell with Anaconda
What to do if you get a Call with too many input arguments error at DoAndReturn in a golang test
What to do if you get `No kernel for language python found` in Hydrogen
What to do if you get a memory error when converting from PySparkDataFrame to PandasDataFrame
What to do if you get an error when importing matplotlib in Python (Mac)
How to check in Python if one of the elements of a list is in another list
What to do if you get the error ʻERR_FEATURE_UNAVAILABLE_ON_PLATFORM` when using ts-node-dev on Linux
Get the file name in a folder using glob
Check if the expected column exists in Pandas DataFrame
If there were no DI containers in the world.
Check if it is Unix in the scripting language
Determine if an attribute is defined in the object
Check if it is Unix in the scripting language
[Python] If you create a file with the same name as the module to be imported, an Attribute Error will occur.
Check the argument type annotation when executing a function in Python and make an error
What to do if you get an error when running "certbot renew" in CakePHP environment
[python] How to check if the Key exists in the dictionary
Why do you add a main ()-if statement in Python?
Get and create nodes added and updated in the new version
Get the number of specific elements in a python list
What to do if a 0xC0000005 error occurs in tf.train.start_queue_runners ()
What to do if you get `locale.Error: unsupported locale setting` when getting the day of the week from a date in Python
How to check if a value exists in an enum
How to get the last (last) value in a list in Python
What to do if you get angry with'vertices' must be a 2D list ... in matplotlib arrow
I made a function to check if the webhook is received in Lambda for the time being
If you are a beginner in programming, why not make a "game" for the time being? The story
If you upgrade the kernel version when the host OS is Linux, an error occurred when launching the virtual environment of VirtualBox, so a memorandum
Error resolution python version check
I get "sanity check" and "No module" errors in import numpy
[Blender] Script to check if the selected one is a mesh
If you get stuck in Cannot load mkl_intel_thread.dll in Python on Windows