awslabs / aws-shell

An integrated shell for working with the AWS CLI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

when i run aws-shell, I got a error

pedro0ren opened this issue · comments

Hi, when I run aws-shell onMac(Python:2.7.10), and I got an error like this

First run, creating autocomplete index...
Traceback (most recent call last):
File "/usr/local/bin/aws-shell", line 11, in
sys.exit(main())
File "/Library/Python/2.7/site-packages/awsshell/init.py", line 47, in main
write_index(index_file)
File "/Library/Python/2.7/site-packages/awsshell/makeindex.py", line 67, in write_index
index_command(current, help_command)
File "/Library/Python/2.7/site-packages/awsshell/makeindex.py", line 59, in index_command
index_command(child, sub_help_command)
File "/Library/Python/2.7/site-packages/awsshell/makeindex.py", line 59, in index_command
index_command(child, sub_help_command)
File "/Library/Python/2.7/site-packages/awsshell/makeindex.py", line 46, in index_command
operation_name=op_name,
TypeError: generate_shorthand_example() got an unexpected keyword argument 'service_name'

Also seeing this error:

$ aws-shell
First run, creating autocomplete index...
Traceback (most recent call last):
File "/home/asd2007/miniconda3/lib/python3.6/site-packages/awsshell/utils.py", line 84, in file_contents
with open(filename, mode) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/asd2007/.aws/shell/cache/completions-1.16.14.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/asd2007/miniconda3/lib/python3.6/site-packages/awsshell/index/completion.py", line 63, in load_index
contents = self._fslayer.file_contents(filename)
File "/home/asd2007/miniconda3/lib/python3.6/site-packages/awsshell/utils.py", line 87, in file_contents
raise FileReadError(str(e))
awsshell.utils.FileReadError: [Errno 2] No such file or directory: '/home/asd2007/.aws/shell/cache/completions-1.16.14.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/asd2007/miniconda3/lib/python3.6/site-packages/awsshell/init.py", line 39, in main
index_str = indexer.load_index(utils.AWSCLI_VERSION)
File "/home/asd2007/miniconda3/lib/python3.6/site-packages/awsshell/index/completion.py", line 65, in load_index
raise IndexLoadError(str(e))
awsshell.index.completion.IndexLoadError: [Errno 2] No such file or directory: '/home/asd2007/.aws/shell/cache/completions-1.16.14.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/asd2007/miniconda3/bin/aws-shell", line 11, in
sys.exit(main())
File "/home/asd2007/miniconda3/lib/python3.6/site-packages/awsshell/init.py", line 47, in main
write_index(index_file)
File "/home/asd2007/miniconda3/lib/python3.6/site-packages/awsshell/makeindex.py", line 67, in write_index
index_command(current, help_command)
File "/home/asd2007/miniconda3/lib/python3.6/site-packages/awsshell/makeindex.py", line 59, in index_command
index_command(child, sub_help_command)
File "/home/asd2007/miniconda3/lib/python3.6/site-packages/awsshell/makeindex.py", line 59, in index_command
index_command(child, sub_help_command)
File "/home/asd2007/miniconda3/lib/python3.6/site-packages/awsshell/makeindex.py", line 46, in index_command
operation_name=op_name,
TypeError: generate_shorthand_example() got an unexpected keyword argument 'service_name'

Python 3.6.3:

 active environment : None
   user config file : /home/asd2007/.condarc
    populated config files : /home/asd2007/.condarc
      conda version : 4.5.11
conda-build version : 3.14.4
     python version : 3.6.3.final.0
   base environment : /home/asd2007/miniconda3  (writable)
       channel URLs : https://conda.anaconda.org/intel/linux-64
                      https://conda.anaconda.org/intel/noarch
                      https://conda.anaconda.org/bioconda/linux-64
                      https://conda.anaconda.org/bioconda/noarch
                      https://conda.anaconda.org/conda-forge/linux-64
                      https://conda.anaconda.org/conda-forge/noarch
                      https://repo.anaconda.com/pkgs/main/linux-64
                      https://repo.anaconda.com/pkgs/main/noarch
                      https://repo.anaconda.com/pkgs/free/linux-64
                      https://repo.anaconda.com/pkgs/free/noarch
                      https://repo.anaconda.com/pkgs/r/linux-64
                      https://repo.anaconda.com/pkgs/r/noarch
                      https://repo.anaconda.com/pkgs/pro/linux-64
                      https://repo.anaconda.com/pkgs/pro/noarch
                      https://conda.anaconda.org/r/linux-64
                      https://conda.anaconda.org/r/noarch
      package cache : /home/asd2007/miniconda3/pkgs
                      /home/asd2007/.conda/pkgs
   envs directories : /home/asd2007/miniconda3/envs
                      /home/asd2007/.conda/envs
           platform : linux-64
         user-agent : conda/4.5.11 requests/2.18.4 CPython/3.6.3 Linux/3.10.0-514.6.2.el7.x86_64 centos/7 glibc/2.17
            UID:GID : 8770:1045
         netrc file : None
       offline mode : False

Same. On a Mac. Tried it with both Python 2.7.15 and 3.7.0 with the same results.

Looks like this was fixed a few days ago with PR #206.

@jamesls, will a release with this fix get pushed up to PyPI sometime soon? Thanks!

In the meantime, it seems to work if you install right off master.

pip install git+https://github.com/awslabs/aws-shell.git

Thank you! It works well now.

same deal here...

No such file or directory: '/home//.aws/shell/cache/completions-1.16.14.json'

installing directly off master did the trick as well.

Confirmed, in order to fix "TypeError: generate_shorthand_example() got an unexpected keyword argument 'service_name' " , I've done "pip install git+https://github.com/awslabs/aws-shell.git" (which is newer than latest v0.2.0) and it works OK now

Still getting the error. even after I tried.

pip install git+https://github.com/awslabs/aws-shell.git

First run, creating autocomplete index...
Traceback (most recent call last):
File "/usr/local/bin/aws-shell", line 11, in
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/awsshell/init.py", line 47, in main
write_index(index_file)
File "/usr/local/lib/python2.7/site-packages/awsshell/makeindex.py", line 67, in write_index
index_command(current, help_command)
File "/usr/local/lib/python2.7/site-packages/awsshell/makeindex.py", line 59, in index_command
index_command(child, sub_help_command)
File "/usr/local/lib/python2.7/site-packages/awsshell/makeindex.py", line 59, in index_command
index_command(child, sub_help_command)
File "/usr/local/lib/python2.7/site-packages/awsshell/makeindex.py", line 46, in index_command
operation_name=op_name,
TypeError: generate_shorthand_example() got an unexpected keyword argument 'service_name'

Same problem seen here (Debian stretch), Installing from master worked.

We've just released v0.2.1 which contains the fix for this issue. Let us know if you're still seeing issues with 0.2.1.

I have been experiencing this for a couple days.

$ aws-shell
First run, creating autocomplete index...
Traceback (most recent call last):
  File "/usr/local/Cellar/aws-shell/0.2.1/libexec/lib/python3.7/site-packages/awsshell/utils.py", line 84, in file_contents
    with open(filename, mode) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/brettf/.aws/shell/cache/completions-1.16.19.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/aws-shell/0.2.1/libexec/lib/python3.7/site-packages/awsshell/index/completion.py", line 63, in load_index
    contents = self._fslayer.file_contents(filename)
  File "/usr/local/Cellar/aws-shell/0.2.1/libexec/lib/python3.7/site-packages/awsshell/utils.py", line 87, in file_contents
    raise FileReadError(str(e))
awsshell.utils.FileReadError: [Errno 2] No such file or directory: '/Users/brettf/.aws/shell/cache/completions-1.16.19.json'
...snip...

Me too. Installing from master did not fix the issue. Installed it both as user and as root

$ aws-shell
First run, creating autocomplete index...
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/awsshell/utils.py", line 84, in file_contents
    with open(filename, mode) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/ubuntu/.aws/shell/cache/completions-1.16.40.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/awsshell/index/completion.py", line 63, in load_index
    contents = self._fslayer.file_contents(filename)
  File "/usr/local/lib/python3.5/dist-packages/awsshell/utils.py", line 87, in file_contents
    raise FileReadError(str(e))
awsshell.utils.FileReadError: [Errno 2] No such file or directory: '/home/ubuntu/.aws/shell/cache/completions-1.16.40.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/awsshell/__init__.py", line 39, in main
    index_str = indexer.load_index(utils.AWSCLI_VERSION)
  File "/usr/local/lib/python3.5/dist-packages/awsshell/index/completion.py", line 65, in load_index
    raise IndexLoadError(str(e))
awsshell.index.completion.IndexLoadError: [Errno 2] No such file or directory: '/home/ubuntu/.aws/shell/cache/completions-1.16.40.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/aws-shell", line 11, in <module>
    load_entry_point('aws-shell==0.2.1', 'console_scripts', 'aws-shell')()
  File "/usr/local/lib/python3.5/dist-packages/awsshell/__init__.py", line 47, in main
    write_index(index_file)
  File "/usr/local/lib/python3.5/dist-packages/awsshell/makeindex.py", line 67, in write_index
    index_command(current, help_command)
  File "/usr/local/lib/python3.5/dist-packages/awsshell/makeindex.py", line 58, in index_command
    sub_help_command = sub_command.create_help_command()
  File "/usr/local/lib/python3.5/dist-packages/awscli/clidriver.py", line 372, in create_help_command
    command_table = self._get_command_table()
  File "/usr/local/lib/python3.5/dist-packages/awscli/clidriver.py", line 326, in _get_command_table
    self._command_table = self._create_command_table()
  File "/usr/local/lib/python3.5/dist-packages/awscli/clidriver.py", line 348, in _create_command_table
    service_model = self._get_service_model()
  File "/usr/local/lib/python3.5/dist-packages/awscli/clidriver.py", line 334, in _get_service_model
    self._service_name, api_version=api_version)
  File "/usr/local/lib/python3.5/dist-packages/botocore/session.py", line 540, in get_service_model
    service_description = self.get_service_data(service_name, api_version)
  File "/usr/local/lib/python3.5/dist-packages/botocore/session.py", line 568, in get_service_data
    service_name=service_name, session=self)
  File "/usr/local/lib/python3.5/dist-packages/botocore/hooks.py", line 356, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/usr/local/lib/python3.5/dist-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/usr/local/lib/python3.5/dist-packages/botocore/handlers.py", line 283, in register_retries_for_service
    service_event_name = hyphenize_service_id(service_id)
  File "/usr/local/lib/python3.5/dist-packages/botocore/utils.py", line 1041, in hyphenize_service_id
    return service_id.replace(' ', '-').lower()
AttributeError: 'NoneType' object has no attribute 'replace'

Why is this issue closed? There doesn't seem to be a resolution and I'm still seeing the same issue today, over 2 years after it was reported.

Installed initially on macOS Catalina 10.15.7 via Homebrew.

$ aws-shell
/usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if x is 0 or x is 1:
/usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if x is 0 or x is 1:
/usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif y is 0 or y is 1:
/usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif y is 0 or y is 1:
/usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages/jmespath/visitor.py:260: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if original_result is 0:
First run, creating autocomplete index...
Traceback (most recent call last):
  File "/usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages/awsshell/utils.py", line 84, in file_contents
    with open(filename, mode) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/erhhungy/.aws/shell/cache/completions-1.16.313.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages/awsshell/index/completion.py", line 63, in load_index
    contents = self._fslayer.file_contents(filename)
  File "/usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages/awsshell/utils.py", line 87, in file_contents
    raise FileReadError(str(e))
awsshell.utils.FileReadError: [Errno 2] No such file or directory: '/Users/erhhungy/.aws/shell/cache/completions-1.16.313.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages/awsshell/__init__.py", line 39, in main
    index_str = indexer.load_index(utils.AWSCLI_VERSION)
  File "/usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages/awsshell/index/completion.py", line 65, in load_index
    raise IndexLoadError(str(e))
awsshell.index.completion.IndexLoadError: [Errno 2] No such file or directory: '/Users/erhhungy/.aws/shell/cache/completions-1.16.313.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/aws-shell", line 33, in <module>
    sys.exit(load_entry_point('aws-shell==0.2.1', 'console_scripts', 'aws-shell')())
  File "/usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages/awsshell/__init__.py", line 47, in main
    write_index(index_file)
  File "/usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages/awsshell/makeindex.py", line 63, in write_index
    driver = awscli.clidriver.create_clidriver()
  File "/usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages/awscli/clidriver.py", line 77, in create_clidriver
    load_plugins(session.full_config.get('plugins', {}),
  File "/usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages/awscli/plugin.py", line 44, in load_plugins
    modules = _import_plugins(plugin_mapping)
  File "/usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages/awscli/plugin.py", line 61, in _import_plugins
    module = __import__(path, fromlist=[module])
ModuleNotFoundError: No module named '/usr/local/opt/awscli/libexec/lib/python3'

I then tried the "update from master branch" suggestion to version 0.2.2, but it didn't seem to help:

/usr/local/Cellar/aws-shell/0.2.1_3/libexec/bin/python3 -m pip install git+https://github.com/awslabs/aws-shell.git

Collecting git+https://github.com/awslabs/aws-shell.git
  Cloning https://github.com/awslabs/aws-shell.git to /private/var/folders/lb/r6s0bsf17n1dpfmy58zp3b9w0000gn/T/pip-req-build-tn02j7j7
Requirement already satisfied: awscli<2.0.0,>=1.16.10 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from aws-shell==0.2.2) (1.16.313)
Requirement already satisfied: prompt-toolkit<1.1.0,>=1.0.0 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from aws-shell==0.2.2) (1.0.18)
Requirement already satisfied: boto3<2.0.0,>=1.9.0 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from aws-shell==0.2.2) (1.10.49)
Requirement already satisfied: configobj<6.0.0,>=5.0.6 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from aws-shell==0.2.2) (5.0.6)
Requirement already satisfied: Pygments<3.0.0,>=2.1.3 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from aws-shell==0.2.2) (2.5.2)
Requirement already satisfied: botocore==1.13.49 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from awscli<2.0.0,>=1.16.10->aws-shell==0.2.2) (1.13.49)
Requirement already satisfied: docutils<0.16,>=0.10 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from awscli<2.0.0,>=1.16.10->aws-shell==0.2.2) (0.15.2)
Requirement already satisfied: rsa<=3.5.0,>=3.1.2 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from awscli<2.0.0,>=1.16.10->aws-shell==0.2.2) (3.4.2)
Requirement already satisfied: s3transfer<0.3.0,>=0.2.0 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from awscli<2.0.0,>=1.16.10->aws-shell==0.2.2) (0.2.1)
Requirement already satisfied: PyYAML<5.3,>=3.10 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from awscli<2.0.0,>=1.16.10->aws-shell==0.2.2) (5.2)
Requirement already satisfied: colorama<0.4.2,>=0.2.5 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from awscli<2.0.0,>=1.16.10->aws-shell==0.2.2) (0.4.1)
Requirement already satisfied: six>=1.9.0 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from prompt-toolkit<1.1.0,>=1.0.0->aws-shell==0.2.2) (1.13.0)
Requirement already satisfied: wcwidth in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from prompt-toolkit<1.1.0,>=1.0.0->aws-shell==0.2.2) (0.1.8)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from boto3<2.0.0,>=1.9.0->aws-shell==0.2.2) (0.9.4)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from botocore==1.13.49->awscli<2.0.0,>=1.16.10->aws-shell==0.2.2) (2.8.1)
Requirement already satisfied: urllib3<1.26,>=1.20 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from botocore==1.13.49->awscli<2.0.0,>=1.16.10->aws-shell==0.2.2) (1.25.7)
Requirement already satisfied: pyasn1>=0.1.3 in /usr/local/Cellar/aws-shell/0.2.1_3/libexec/lib/python3.9/site-packages (from rsa<=3.5.0,>=3.1.2->awscli<2.0.0,>=1.16.10->aws-shell==0.2.2) (0.4.8)
Building wheels for collected packages: aws-shell
  Building wheel for aws-shell (setup.py) ... done
  Created wheel for aws-shell: filename=aws_shell-0.2.2-py2.py3-none-any.whl size=50556 sha256=fadb788aeb50428a0ac56fad06cf0065af4b2e6d314affb4603380d0980845e4
  Stored in directory: /private/var/folders/lb/r6s0bsf17n1dpfmy58zp3b9w0000gn/T/pip-ephem-wheel-cache-84434u0p/wheels/3a/9f/59/e483fb27c7863a2fcfa31ac1bd1262870b41d369eb8bed958a
Successfully built aws-shell
Installing collected packages: aws-shell
  Attempting uninstall: aws-shell
    Found existing installation: aws-shell 0.2.1
    Uninstalling aws-shell-0.2.1:
      Successfully uninstalled aws-shell-0.2.1
Successfully installed aws-shell-0.2.2

Same issue, though errors start from the "First run, creating autocomplete index..." line.
Worth noting, I also installed directly without Homebrew using existing Python3.8.

Any updates on this?

Also having the same problem on Linux Mint 20.1 with 0.2.2, like others here installing from master does not solve it.

But it was because I had not used pip3 to install aws-shell. I uninstalled, re-installed using pip3 and upgraded the version of awscli also and now it works fine.

commented

Needed to use pip3 on Debian 10.