Make sure you are using Python3 and Boto3. If you dont have the entire code samples, you can get them here:
[List users.py](https://s3.amazonaws.com/www.labr.net/assets/tools/cognito/listuser.py)
[addusers.py](https://s3.amazonaws.com/www.labr.net/assets/tools/cognito/adduser.py)
I build addusers.py to read from a file.
This code won’t Likely work if you are running it a browser because there will be no authentication credentials. Boto3 uses the same credential structure as the AWS CLI. Hope that helps.