AWS CLI errors on Windows 10
I encountered two errors when using AWS CLI for the first time on Windows 10.
The use case: deploying a static site to an S3 bucket.
Error 1: no module named awscli.clidriver
aws --version or the deploy command gave the error:
Traceback (most recent call last): File "<path to aws>", line 50, in <module> import awscli.clidriver ImportError: No module named 'awscli.clidriver'
StackOverflow has a few suggestions.
If you're on Linux, the first thing I would try is uninstalling and reinstalling with sudo. That StackOverflow thread is a couple of years old. Make sure you're using the latest commands.
However, trying running
pip3 as admin didn't work, nor did ensuring my Python 3.x was before Python 2.x in my PATH.
I reluctantly uninstalled, and used the MSI installer. Error resolved, although according to the AWS docs I've probably set myself up for issues when upgrading.
Error 2: unknown encoding: idna
The full error:
upload failed: <filepath> to <destination filepath> An HTTP Client raised and unhandled exception: unknown encoding: idna
This is one of those "not really an error" situations - although it said upload had failed, nothing appeared broken when I visited the website.
Nonetheless, back to StackOverflow. I went with this answer.