# libtmux.exc.NotInsideTmux

- **Module:** libtmux.exc
- **Package:** libtmux
- **Language:** Python
- **Kind:** exception
- **Source:** https://github.com/tmux-python/libtmux/blob/036c521c4b83ce6e434eb50afe2a0d08a6a05e46/src/libtmux/exc.py#L102
- **Page:** https://libtmux.org/reference/py/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.

## Example

```python
>>> from libtmux import exc
>>> str(exc.NotInsideTmux("TMUX"))
'Not inside a tmux pane: $TMUX is unset or empty'
```

## Example

```python
>>> str(exc.NotInsideTmux("TMUX_PANE", reason="not a pane id"))
'Not inside a tmux pane: $TMUX_PANE is not a pane id'
```

## Example

```python
>>> str(exc.NotInsideTmux())
'Not inside a tmux pane'
```

## Example

It is part of the :exc:`LibTmuxException` hierarchy:

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

## Members

- `__init__` (method)
- `__str__` (method) — Render with optional ``"<subcommand>: …"`` prefix.
