asciinema / asciinema

Terminal session recorder 📹

Home Page:https://asciinema.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Alpine Crash "FileNotFoundError: [Errno 2] No such file or directory: 'tput'"

mrneo240 opened this issue · comments

$ cat /etc/os-release

NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.11.3
PRETTY_NAME="Alpine Linux v3.11"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"

$ asciinema rec

asciinema: recording asciicast to /tmp/tmpoa7wg6xn-ascii.cast
asciinema: press <ctrl-d> or type "exit" when you're done
Traceback (most recent call last):
  File "/usr/bin/asciinema", line 11, in <module>
    load_entry_point('asciinema==2.0.2', 'console_scripts', 'asciinema')()
  File "/usr/lib/python3.8/site-packages/asciinema/__main__.py", line 131, in main
    code = command.execute()
  File "/usr/lib/python3.8/site-packages/asciinema/commands/record.py", line 69, in execute
    asciinema.record_asciicast(
  File "/usr/lib/python3.8/site-packages/asciinema/__init__.py", line 33, in record_asciicast
    w, h = term.get_size()
  File "/usr/lib/python3.8/site-packages/asciinema/term.py", line 35, in get_size
    int(subprocess.check_output(['tput', 'cols'])),
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 489, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'tput'

I have the same on Void Linux; turns out tput is part of the ncurses package, and installing that should fix it (on any Linux flavour).

I also created a PR which should fix it: #423

commented

I try #423, not worked also

I cancel tput, return the result directly 😂

def get_size():
    # TODO maybe use os.get_terminal_size ?
    # return (
    #     int(subprocess.check_output(['tput', 'cols'])),
    #     int(subprocess.check_output(['tput', 'lines']))
    # )
    
    return (200, 50)