Forum Archive

Help with setting up awscli on StaSh

patsu

Hi all,

I am a first time Pythonista user. I would like to set up my iPad as a AWS management client.

I installed StaSh using the instructions here:
https://forum.omz-software.com/topic/1919/stash-shell-like-an-expert-in-pythonista

Then:
pip install awscli
pip install boto3
pip install colorama
pip install docutils

All these modules (and botocore) are kept in stash_extensions/bin for StaSh to access.

In my StaSh instance, I type "awscli configure", "awscli help", or just "awscli" to launch the aws client.

I expected some usage error message.
Unfortunately, all StaSh does is print out "stash: 21".

What am I doing wrong ?

patsu

Hmph, I reinstalled awscli and left all the installed packages in ~/Documents/site-packages-3/ "as is" after running pip install awscli (and friends).

(I manually moved them to stash_extensions/bin in my first attempt).

How do I tell StaSh to look for awscli in ~/Documents/site-packages-3/ ?
It can't find awscli right now because only ~/Documents/site-package/stash/bin and ~/Documents/bin are in BIN_PATH.

I can't seem to set BIN_PATH in ~/Documents/site-package/stash/.stashrc

patsu

After my second "pip install awscli" attempt, I used "python3 -m awscli configure" successfully to start configuration.

Right off the bat, I noticed all aws help options are broken because groff is not available.

Will toy with the command to see if the rest works for me.

bennr01

If you want more debug informations, try stashconf py_traceback 1. This should enable tracebacks. Please try again and post the traceback here.

patsu

Turns out I could only run awscli once in a Pythonista session.
Once I run "python3 -m awscli" exactly once in any StaSh instance, I have to kill Pythonista and relaunch StaSh to run the same command.

I was able to complete "python3 -m awscli configure" when there's no botocore.exceptions.DataNotFoundError error.

Transcript below:

StaSh v0.7.1 on python 3.6.1
Warning: you are running StaSh in python3. Some commands may not work correctly in python3.
Please help us improving StaSh by reporting bugs on github.
Tip: A branch name can be specified to allow selfupdate from a branch other than master
[~/Documents]$ stashconf py_traceback 1
[~/Documents]$ python3 -m awscli
usage: aws [options] [ ...] [parameters]
To see help text, you can run:

aws help
aws help
aws help
aws: error: too few arguments
[~/Documents]$ python3 -m awscli
: Unable to load data for: cli
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/FAD96831-3867-4065-A02F-BEB0988CDD5A/Pythonista3/Documents/site-packages/stash/system/shruntime.py", line 547, in exec_py_file
exec(code, namespace, namespace)
File "site-packages/stash/bin/python3.py", line 64, in
runpy.run_module(ns.module, run_name='main')
File "/var/containers/Bundle/Application/6B045F85-2C00-4128-B62A-FBFCF31DF758/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/runpy.py", line 209, in run_module
return _run_code(code, {}, init_globals, run_name, mod_spec)
File "/var/containers/Bundle/Application/6B045F85-2C00-4128-B62A-FBFCF31DF758/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/private/var/mobile/Containers/Shared/AppGroup/FAD96831-3867-4065-A02F-BEB0988CDD5A/Pythonista3/Documents/site-packages-3/awscli/main.py", line 20, in
sys.exit(main())
File "/private/var/mobile/Containers/Shared/AppGroup/FAD96831-3867-4065-A02F-BEB0988CDD5A/Pythonista3/Documents/site-packages-3/awscli/clidriver.py", line 59, in main
rc = driver.main()
File "/private/var/mobile/Containers/Shared/AppGroup/FAD96831-3867-4065-A02F-BEB0988CDD5A/Pythonista3/Documents/site-packages-3/awscli/clidriver.py", line 194, in main
parser = self._create_parser(command_table)
File "/private/var/mobile/Containers/Shared/AppGroup/FAD96831-3867-4065-A02F-BEB0988CDD5A/Pythonista3/Documents/site-packages-3/awscli/clidriver.py", line 174, in _create_parser
command_table['help'] = self.create_help_command()
File "/private/var/mobile/Containers/Shared/AppGroup/FAD96831-3867-4065-A02F-BEB0988CDD5A/Pythonista3/Documents/site-packages-3/awscli/clidriver.py", line 165, in create_help_command
cli_data = self._get_cli_data()
File "/private/var/mobile/Containers/Shared/AppGroup/FAD96831-3867-4065-A02F-BEB0988CDD5A/Pythonista3/Documents/site-packages-3/awscli/clidriver.py", line 97, in _get_cli_data
self._cli_data = self.session.get_data('cli')
File "/private/var/mobile/Containers/Shared/AppGroup/FAD96831-3867-4065-A02F-BEB0988CDD5A/Pythonista3/Documents/site-packages-3/botocore/session.py", line 444, in get_data
return self.get_component('data_loader').load_data(data_path)
File "/private/var/mobile/Containers/Shared/AppGroup/FAD96831-3867-4065-A02F-BEB0988CDD5A/Pythonista3/Documents/site-packages-3/botocore/loaders.py", line 132, in _wrapper
data = func(self, args, *kwargs)
File "/private/var/mobile/Containers/Shared/AppGroup/FAD96831-3867-4065-A02F-BEB0988CDD5A/Pythonista3/Documents/site-packages-3/botocore/loaders.py", line 424, in load_data
raise DataNotFoundError(data_path=name)
botocore.exceptions.DataNotFoundError: Unable to load data for: cli
[~/Documents]$