NDAR / nda_aws_token_generator

Repository with sample code and libraries for obtaining AWS credentials to use with your NIMH Data Archives account
MIT License
9 stars 11 forks source link

username requires quotes #4

Open agt24 opened 6 years ago

agt24 commented 6 years ago

I needed to put my username in single quotes in order to get get_token_example.py to work (see below). Not sure if there's something unique to my environment, but it might be worth including a note in the README.

` (awscli) [adamt@felix python]$ python get_token_example.py Enter your NIMH Data Archives username:adamt Traceback (most recent call last): File "get_token_example.py", line 6, in username = input('Enter your NIMH Data Archives username:') File "", line 1, in NameError: name 'adamt' is not defined (awscli) [adamt@felix python]$

(awscli) [adamt@felix python]$ python get_token_example.py Enter your NIMH Data Archives username:'adamt' Enter your NIMH Data Archives password: aws_access_key_id=XXX aws_secret_access_key=XXX security_token=XXX expiration=2018-05-03T04:04:48-04:00

(awscli) [adamt@felix python]$ `

devjason commented 6 years ago

Thanks for the feedback! Python is attempting to automatically eval what is read here which is causing the NameError, the current example script is mixing Python 3 and 2 concepts (raw_input from 2 was renamed to input in 3 in PEP 3111).

In Python 2 environments you can replace input with raw_input to prevent this problem and avoid having to quote your username.