schollz / howmanypeoplearearound

Count the number of people around you :family_man_man_boy: by monitoring wifi signals :satellite:
MIT License
6.92k stars 386 forks source link

Handle curses errors gracefully #48

Closed juergenhoetzel closed 5 years ago

juergenhoetzel commented 5 years ago

Starting howmanypeoplearearound using xterm-color as $TERM resulted in:

Traceback (most recent call last):
  File "howmanypeoplearearound/__main__.py", line 131, in scan
    adapter, index = pick(netifaces.interfaces(), title)
  File "/home/juergen/python/pick/pick/__init__.py", line 191, in pick
    return picker.start()
  File "/home/juergen/python/pick/pick/__init__.py", line 177, in start
    return curses.wrapper(self._start)
  File "/usr/lib/python3.7/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/juergen/python/pick/pick/__init__.py", line 173, in _start
    self.config_curses()
  File "/home/juergen/python/pick/pick/__init__.py", line 166, in config_curses
    curses.curs_set(0)
_curses.error: curs_set() returned ERR

Root cause: The unmaintained xterm-color terminfo doesn't have the cursor_invisible capability.

Using this commit results in more "user-friendly" error message:

Please check your $TERM settings: curs_set() returned ERR
schollz commented 5 years ago

@juergenhoetzel Looks good, thanks!