CLI not compatible with Python 3+
See original GitHub issueGetting a syntax error when I try to run the CLI commands. The print statement in the CLI init.py file doesn’t have parentheses:
print event['timestamp'], event['logShortId'], event['message'].strip()
^
SyntaxError: invalid syntax
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:6 (2 by maintainers)
Top Results From Across the Web
AWS CLI not working because of unsupported Python version
The issue I'm having is that aliasing python to python3 isn't working. For some reason, after aliasing, the installer still references Python ......
Read more >4. Using Python on Windows — Python 3.11.1 documentation
This document aims to give an overview of Windows-specific behaviour you should know about when using Python on Microsoft Windows. Unlike most Unix...
Read more >The AWS CLI and AWS SDK for Python will require Python 2.7 ...
I'm currently using Python 2.6 or Python 3.3 as my runtime for AWS CLI or AWS SDK for Python. What should I do?...
Read more >Support for Python 3 · Issue #1337 · nodejs/node-gyp - GitHub
I have had python 3 installed forever and do not want python 2 as it can cause havoc to have both installed as...
Read more >Python 3 Support — Click Documentation (7.x)
Click supports Python 3, but like all other command line utility ... For more information see Python 3 Surrogate Handling. ... This is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The intent is for chalice to support the same versions of python that AWS Lambda supports, which is currently python 2.7. So while possible to make it work, it could be confusing to work on your app in python3, but only to have it fail when deploying to lambda.
The more technical reason why supporting python3 is challenging in chalice is because chalice introspects your source code in order to configure things automatically for you, including importing your
app.py
file so we can iterate through all your@app.route
declarations and parsing your app source code using theast
andsymtable
module for policy generation. So even if the chalice code base worked in python2/python3, the minute we try to import your app, and your app happens to have a"print 'foo'"
statement in it, it’ll fail.It is hard to believe that Amazon’s premier entry in the hot “serverless” space still only supports the dying technology of Python 2. For those that haven’t looked in recent years, support for Python 2 is due to end in 2020. Ubuntu doesn’t even install it by default. A summary of the situation (with a nice graphical timeline showing nearly all other enviroments already ported to Python 3) is at http://www.python3statement.org/
Please reopen this bug until Chalice at least provides better support for projects that are trying to ensure Python 3 compatibility, i.e. having code that can be imported into a python 3 code base.