doitlive icon indicating copy to clipboard operation
doitlive copied to clipboard

doitlive doesn't run on stock CentOS 7

Open omkensey opened this issue 5 years ago • 4 comments

doitlive successfully installs on CentOS 7 after pip upgrade'ing pip and setuptools, but will not execute a shell script. I have this script:

#!/bin/bash

echo $RANDOM
date +%s
curl https://www.usno.navy.mil/USNO/time | grep "Master Clock"

When I try to play it with doitlive, I get a stack trace:

$ doitlive play ./test.sh 
We'll do it live!
STARTING SESSION: Press Ctrl-C at any time to exit.
Press any key to continue ...



Traceback (most recent call last):
  File "/home/kensey/.local/bin/doitlive", line 8, in <module>
    sys.exit(cli())
  File "/home/kensey/.local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/kensey/.local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/kensey/.local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/kensey/.local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/kensey/.local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/kensey/.local/lib/python2.7/site-packages/doitlive/cli.py", line 428, in play
    commentecho=commentecho,
  File "/home/kensey/.local/lib/python2.7/site-packages/doitlive/cli.py", line 245, in run
    goto_stealthmode = magicrun(command, **state)
  File "/home/kensey/.local/lib/python2.7/site-packages/doitlive/keyboard.py", line 216, in magicrun
    goto_regulartype = magictype(text, prompt_template, speed)
  File "/home/kensey/.local/lib/python2.7/site-packages/doitlive/keyboard.py", line 40, in magictype
    echo_prompt(prompt_template)
  File "/home/kensey/.local/lib/python2.7/site-packages/doitlive/styling.py", line 222, in echo_prompt
    prompt = make_prompt_formatter(template)()
  File "/home/kensey/.local/lib/python2.7/site-packages/doitlive/styling.py", line 218, in <lambda>
    return lambda: format_prompt(tpl)
  File "/home/kensey/.local/lib/python2.7/site-packages/doitlive/styling.py", line 196, in format_prompt
    return prompt.format(**get_prompt_state())
  File "/home/kensey/.local/lib/python2.7/site-packages/doitlive/styling.py", line 236, in get_prompt_state
    "git_branch": _branch_to_term_string(get_current_git_branch()),
  File "/home/kensey/.local/lib/python2.7/site-packages/doitlive/version_control.py", line 12, in get_current_git_branch
    proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Installation info:

$ python --version
Python 2.7.5
$ pip show pip setuptools doitlive click click-completion click-didyoumean
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Name: pip
Version: 20.0.1
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: [email protected]
License: MIT
Location: /usr/lib/python2.7/site-packages
Requires: 
Required-by: 
---
Name: setuptools
Version: 44.0.0
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: [email protected]
License: UNKNOWN
Location: /home/kensey/.local/lib/python2.7/site-packages
Requires: 
Required-by: 
---
Name: doitlive
Version: 4.3.0
Summary: Because sometimes you need to do it live.
Home-page: https://github.com/sloria/doitlive
Author: Steven Loria
Author-email: [email protected]
License: MIT
Location: /home/kensey/.local/lib/python2.7/site-packages
Requires: click, click-completion, click-didyoumean
Required-by: 
---
Name: Click
Version: 7.0
Summary: Composable command line interface toolkit
Home-page: https://palletsprojects.com/p/click/
Author: Armin Ronacher
Author-email: [email protected]
License: BSD
Location: /home/kensey/.local/lib/python2.7/site-packages
Requires: 
Required-by: doitlive, click-didyoumean, click-completion
---
Name: click-completion
Version: 0.5.2
Summary: Fish, Bash, Zsh and PowerShell completion for Click
Home-page: https://github.com/click-contrib/click-completion
Author: Gaëtan Lehmann
Author-email: [email protected]
License: MIT
Location: /home/kensey/.local/lib/python2.7/site-packages
Requires: click, jinja2, six, shellingham, enum34
Required-by: doitlive
---
Name: click-didyoumean
Version: 0.0.3
Summary: Enable git-like did-you-mean feature in click.
Home-page: https://github.com/timofurrer/click-didyoumean
Author: Timo Furrer
Author-email: [email protected]
License: UNKNOWN
Location: /home/kensey/.local/lib/python2.7/site-packages
Requires: click
Required-by: doitlive

omkensey avatar Jan 24 '20 02:01 omkensey

Is git installed? I think we might need to catch IOError here to handle if git isn't installed.

sloria avatar Jan 24 '20 03:01 sloria

That fixed it! (What's the dependency on git?)

omkensey avatar Jan 24 '20 16:01 omkensey

When displaying prompts we attempt to show the current git branch if the cwd is a git repo. But it should fail gracefully when git isn't installed. Would you like to send a PR with the IOError handling? If not, I can probably take care of it over the weekend.

sloria avatar Jan 24 '20 16:01 sloria

I've got a bit of a crunch going on this weekend, but I also have a workaround, so if you want to leave this here I'll be happy to take a whack at it later in the week.

omkensey avatar Jan 26 '20 22:01 omkensey

Closing for now since this issue is a bit stale. feel free to comment if it's still an issue though

sloria avatar Jan 31 '24 11:01 sloria