Well it’s finally happened. Python 2.7 has gone end of life. This may not mean anything very immediately for you on your local servers, however this can post a problem with AWS Lambdas or other cloud platform functions.

Fortunately Python has a remarkably easy solution for making this transition seamless. 2to3 is a python code translation program that allows you to convert your python 2.x code the 3.x code.

To view the incompatible code and what the updated code would look like in a diff like sort of statement run the following:

python 2to3 <yourPathToFile.py>

If you would like to write the changes to the file you can run the same command with a -w flag:

python 2to3 -w <yourPathToFile.py>

This made my AWS Python lambdas quick and easy to update, simply updating my cloudformation templates with the updated code after running 2to3 and changing the runtime in the Yaml file to Runtime: “python3.6”