Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Specific exceptions raising if pane or window manually closed

Aperta
#340 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
api, cli

Direzione di ricerca

The traceback points to libtmux/pane.py (_info and send_keys) and libtmux/window.py (_info and kill_window); start there and reproduce each operation after its pane or window is manually closed. Done means these cases raise specific exceptions instead of IndexError.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Specific exceptions should be raised in some cases.

For example, if we send keys to a previously attached pane of a window, but the window is manually closed while the program is running, this hapens:

Traceback (most recent call last)
[...]
 File "/usr/share//class_tmuxserver.py", line 78, in create_or_clear_window
    self.dict_panes[window_name]["pane_cmd"].send_keys('C-c', enter=False, suppress_history=False)

  File "/usr/share//venv/lib/python3.8/site-packages/libtmux/pane.py", line 117, in send_keys
    self.cmd('send-keys', prefix + cmd)
  File "/usr/share//venv/lib/python3.8/site-packages/libtmux/pane.py", line 90, in cmd
    args = ('-t', self.get('pane_id')) + args
  File "/usr/local/lib/python3.8/_collections_abc.py", line 660, in get
    return self[key]
  File "/usr/share//venv/lib/python3.8/site-packages/libtmux/common.py", line 251, in __getitem__
    return self._info[key]
  File "/usr/share//venv/lib/python3.8/site-packages/libtmux/pane.py", line 75, in _info
    return list(filter(by, self.server._panes))[0]
`IndexError: list index out of range`

Same thing if we try to kill a window which was manually closed in the tmux:

Traceback (most recent call last)
 [...]
  File "/home/admin//src/class_tmuxserver.py", line 116, in kill_tmux_window
    self.dict_windows[window_name].kill_window()
  File "/home/admin//venv/lib64/python3.7/site-packages/libtmux/window.py", line 308, in kill_window
    '-t%s:%s' % (self.get('session_id'), self.index),
  File "/usr/lib64/python3.7/_collections_abc.py", line 660, in get
    return self[key]
  File "/home/admin//venv/lib64/python3.7/site-packages/libtmux/common.py", line 252, in __getitem__
    return self._info[key]
  File "/home/admin//venv/lib64/python3.7/site-packages/libtmux/window.py", line 89, in _info
    return ret[0]
IndexError: list index out of range
Lingua principale
Python
Stelle
1.2k
Fork
127
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tmux-python/libtmux

Tutte le issue di tmux-python/libtmux

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.