0

Trying to create a Python application on ElasticBeanstalk using the CLI, after I select my platform version I get the following error:

Select a platform version.
1) Python 3.4
2) Python
3) Python 2.7
4) Python 3.4 (Preconfigured - Docker)
(default is 1): 1
ERROR: UnicodeDecodeError :: 'ascii' codec can't decode byte 0xe2 in position 891: ordinal not in range(128)

I found this: https://github.com/aws/aws-cli/issues/708 which makes me think maybe I pasted my AWS credentials with a newline attached. I'd like to re-enter the credentials but it seems they are cached somewhere (it asked me for them on the first install attempt but not any subsequence attempts). I do not see them in my environment vars and I have been deleting .elasticbeanstalk between attempts. Any ideas?

update: I deleted .aws/config so it allowed me to re-enter my credentials. Still get the same error when I try to run eb init

update2: gist of --debug output can be found here: https://gist.github.com/dshuhler/8d64849021c48bf1ba71

3 Answers 3

3

tldr; My .gitignore had a hidden non-ascii character as I had copy pasted a Python specific .gitignore from a popular Github repository.


Steps I took to figure out the root cause

So, I couldn't find any answer that helped me solve this problem for me. Looks like, different people are seeing this error for different reasons.

I'm going to share the steps I took to figure out the cause for my problem. Make sure to run your command using --debug flag

$ eb init --debug

My output was something like this

2019-05-05 13:44:17,548 (INFO) eb : Traceback (most recent call last):
  File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/core/ebrun.py", line 62, in run_app
    app.run()
  File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/cement/core/foundation.py", line 797, in run
    return_val = self.controller._dispatch()
  File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/cement/core/controller.py", line 472, in _dispatch
    return func()
  File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/cement/core/controller.py", line 478, in _dispatch
    return func()
  File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/core/abstractcontroller.py", line 89, in default
    self.do_command()
  File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/controllers/initialize.py", line 118, in do_command
    initializeops.setup(app_name, region_name, platform, dir_path=None, repository=repository, branch=branch)
  File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/operations/initializeops.py", line 57, in setup
    setup_ignore_file()
  File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/operations/initializeops.py", line 92, in setup_ignore_file
    source_control.set_up_ignore_file()
  File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/objects/sourcecontrol.py", line 294, in set_up_ignore_file
    for line in f:
  File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 1287: ordinal not in range(128)

I jumped into the source code, specifically this bit

for line in f:

I found out this is the part which was throwing the error

with open('.gitignore', 'r') as f:
    for line in f:
        if line.strip() == git_ignore[0]:
            return

Once I removed the .gitignore it worked like charm(and added it later without copy-paste)

Sign up to request clarification or add additional context in comments.

2 Comments

This is fixed in current github/gitignore. github.com/github/gitignore/pull/3050
Cutting it out from the repo and repasting it once eb init was done worked
1

It could be that your Beanstalk runs the Python environment without LC_ALL defined. Setting LC_ALL=en_US.UTF-8 in my Beanstalk environment properties resolved this issue for me.

Some background on these locale environment variables is available at: Explain the effects of export LANG, LC_CTYPE, LC_ALL

Comments

0

your aws credentials are at ~/.aws/config

5 Comments

This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
@4dgaurav the person asked where are the credentials, and my answer fits his question. not sure why you think differently.
this might be a comment to OP's question, in case otherwise, if OP accepts your answer, I will delete my comment.
unfortunately this did not solve the problem. I updated the OP
@DanS. can you share the rest of your setup? run it with --debug and share the output in a gist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.