libtmux Reference MCP Search
On this page

libtmux.exc.NotInsideTmux

View as Markdown

Module
libtmux.exc
Package
libtmux
Source
src/libtmux/exc.py
exception libtmux.exc.NotInsideTmux
exception [source]
exception [source]
exception libtmux.exc.NotInsideTmux

Raised when the process is not running inside a tmux pane.

tmux exports $TMUX and $TMUX_PANE into the environment of every pane it spawns. The from_env() family raises this when one of them is missing or malformed -- i.e. the caller is not (or is no longer) recognizable as a tmux pane's child process.

Examples

>>> from libtmux import exc
>>> str(exc.NotInsideTmux("TMUX"))
'Not inside a tmux pane: $TMUX is unset or empty'
>>> str(exc.NotInsideTmux("TMUX_PANE", reason="not a pane id"))
'Not inside a tmux pane: $TMUX_PANE is not a pane id'
>>> str(exc.NotInsideTmux())
'Not inside a tmux pane'

It is part of the LibTmuxException hierarchy:

>>> issubclass(exc.NotInsideTmux, exc.LibTmuxException)
True

1 declared, 1 inherited

Members

Inherited members

Reached through libtmux.exc.LibTmuxException.

  • __str__ libtmux.exc.LibTmuxException Render with optional "<subcommand>: …" prefix.
Esc

Type to search.