ExceptionsΒΆ
libtmux exceptions.
libtmux.excΒΆ
-
libtmux.exc._format_query(query)ΒΆlibtmux.exc._format_query(query)ΒΆ
Render a
QueryList.get()lookup back askey=valuetext.Examples
>>> from libtmux.exc import _format_query >>> _format_query({"pane_id": "%0"}) "pane_id='%0'"
>>> _format_query({"window_name": "shared", "window_index": "1"}) "window_name='shared', window_index='1'"
>>> _format_query({}) ''
-
exception libtmux.exc.LibTmuxExceptionΒΆexception libtmux.exc.LibTmuxExceptionΒΆ
Bases:
ExceptionBase Exception for libtmux Errors.
-
exception libtmux.exc.DeprecatedErrorΒΆexception libtmux.exc.DeprecatedErrorΒΆ
Bases:
LibTmuxExceptionRaised when a deprecated function, method, or parameter is used.
This exception provides clear guidance on what to use instead.
-
exception libtmux.exc.TmuxSessionExistsΒΆexception libtmux.exc.TmuxSessionExistsΒΆ
Bases:
LibTmuxExceptionSession does not exist in the server.
-
exception libtmux.exc.TmuxCommandNotFoundΒΆexception libtmux.exc.TmuxCommandNotFoundΒΆ
Bases:
LibTmuxExceptionApplication binary for tmux not found.
-
exception libtmux.exc.NotInsideTmuxΒΆexception libtmux.exc.NotInsideTmuxΒΆ
Bases:
LibTmuxExceptionRaised when the process is not running inside a tmux pane.
tmux exports
$TMUXand$TMUX_PANEinto the environment of every pane it spawns. Thefrom_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.- Parameters:
variable (
str,optional) β Name of the offending environment variable, e.g."TMUX".reason (
str) β Why it is unusable. Defaults to"unset or empty".*args (
object) β Forwarded toLibTmuxException.
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
LibTmuxExceptionhierarchy:>>> issubclass(exc.NotInsideTmux, exc.LibTmuxException) True
Added in version 0.62.
-
exception libtmux.exc.ObjectDoesNotExistΒΆexception libtmux.exc.ObjectDoesNotExistΒΆ
Bases:
LibTmuxExceptionA lookup expected one object and matched none.
Raised by
get()when nothing matches and nodefaultwas passed.- Parameters:
*args (
object) β A ready-made message, forwarded toLibTmuxException. When omitted, the message is built from query.query (
Mapping, optional) β The lookup that matched nothing, e.g.{"pane_id": "%99"}.
Examples
>>> from libtmux import exc >>> str(exc.ObjectDoesNotExist()) 'No objects found'
A lookup that named what it wanted says so:
>>> str(exc.ObjectDoesNotExist(query={"pane_id": "%99"})) "No objects found: pane_id='%99'"
It is part of the
LibTmuxExceptionhierarchy, soexcept LibTmuxExceptioncatches it:>>> issubclass(exc.ObjectDoesNotExist, exc.LibTmuxException) True
Changed in version 0.62: Re-based on
LibTmuxExceptionand given a message.
-
exception libtmux.exc.MultipleObjectsReturnedΒΆexception libtmux.exc.MultipleObjectsReturnedΒΆ
Bases:
LibTmuxExceptionA lookup expected one object and matched several.
Raised by
get(). UnlikeObjectDoesNotExist, adefaultdoes not suppress it: adefaultis a stand-in for an object that is absent, and an ambiguous lookup is not an absent one. Silently answering with one of several equally valid matches is how you end up driving the wrong pane.On a server-wide collection, several matches for a single id is ordinary and means the window is linked into more than one session. See When one window is in two sessions for what to do about it.
- Parameters:
*args (
object) β A ready-made message, forwarded toLibTmuxException. When omitted, the message is built from count and query.count (
int,optional) β How many objects the lookup matched.query (
Mapping, optional) β The lookup that matched them, e.g.{"pane_id": "%0"}.
Examples
>>> from libtmux import exc >>> str(exc.MultipleObjectsReturned()) 'Multiple objects returned'
A lookup that matched too much reports how much, and for what:
>>> str(exc.MultipleObjectsReturned(count=2, query={"pane_id": "%0"})) "Multiple objects returned (2): pane_id='%0'"
It is part of the
LibTmuxExceptionhierarchy, soexcept LibTmuxExceptioncatches it:>>> issubclass(exc.MultipleObjectsReturned, exc.LibTmuxException) True
Added in version 0.62: Added to
libtmux.excas aLibTmuxExceptionsubclass with a message.
-
exception libtmux.exc.TmuxObjectDoesNotExistΒΆexception libtmux.exc.TmuxObjectDoesNotExistΒΆ
Bases:
ObjectDoesNotExisttmux has no object with the id that was asked for.
Examples
>>> from libtmux import exc >>> str(exc.TmuxObjectDoesNotExist()) 'Could not find object'
>>> str( ... exc.TmuxObjectDoesNotExist( ... obj_key="pane_id", ... obj_id="%99", ... list_cmd="list-panes", ... list_extra_args=("-t", "%99"), ... ) ... ) "Could not find pane_id=%99 for list-panes ('-t', '%99')"
-
exception libtmux.exc.VersionTooLowΒΆexception libtmux.exc.VersionTooLowΒΆ
Bases:
LibTmuxExceptionRaised if tmux below the minimum version to use libtmux.
-
exception libtmux.exc.BadSessionNameΒΆexception libtmux.exc.BadSessionNameΒΆ
Bases:
LibTmuxExceptionDisallowed session name for tmux (empty, contains periods or colons).
-
exception libtmux.exc.OptionErrorΒΆexception libtmux.exc.OptionErrorΒΆ
Bases:
LibTmuxExceptionRoot error for any error involving invalid, ambiguous or bad options.
-
exception libtmux.exc.UnknownOptionΒΆexception libtmux.exc.UnknownOptionΒΆ
Bases:
OptionErrorOption unknown to tmux show-option(s) or show-window-option(s).
-
exception libtmux.exc.UnknownColorOptionΒΆexception libtmux.exc.UnknownColorOptionΒΆ
Bases:
UnknownOptionUnknown color option.
-
exception libtmux.exc.InvalidOptionΒΆexception libtmux.exc.InvalidOptionΒΆ
Bases:
OptionErrorOption invalid to tmux.
-
exception libtmux.exc.AmbiguousOptionΒΆexception libtmux.exc.AmbiguousOptionΒΆ
Bases:
OptionErrorOption that could potentially match more than one.
-
exception libtmux.exc.WaitTimeoutΒΆexception libtmux.exc.WaitTimeoutΒΆ
Bases:
LibTmuxExceptionFunction timed out without meeting condition.
-
exception libtmux.exc.VariableUnpackingErrorΒΆexception libtmux.exc.VariableUnpackingErrorΒΆ
Bases:
LibTmuxExceptionError unpacking variable.
-
exception libtmux.exc.PaneErrorΒΆexception libtmux.exc.PaneErrorΒΆ
Bases:
LibTmuxExceptionAny type of pane related error.
-
exception libtmux.exc.PaneNotFoundΒΆexception libtmux.exc.PaneNotFoundΒΆ
Bases:
PaneErrorPane not found.
-
exception libtmux.exc.WindowErrorΒΆexception libtmux.exc.WindowErrorΒΆ
Bases:
LibTmuxExceptionAny type of window related error.
-
exception libtmux.exc.MultipleActiveWindowsΒΆexception libtmux.exc.MultipleActiveWindowsΒΆ
Bases:
WindowErrorMultiple active windows.
-
exception libtmux.exc.NoActiveWindowΒΆexception libtmux.exc.NoActiveWindowΒΆ
Bases:
WindowErrorNo active window found.
-
exception libtmux.exc.NoWindowsExistΒΆexception libtmux.exc.NoWindowsExistΒΆ
Bases:
WindowErrorNo windows exist for object.
-
exception libtmux.exc.AdjustmentDirectionRequiresAdjustmentΒΆexception libtmux.exc.AdjustmentDirectionRequiresAdjustmentΒΆ
Bases:
LibTmuxException,ValueErrorIf adjustment_direction is set, adjustment must be set.
-
exception libtmux.exc.WindowAdjustmentDirectionRequiresAdjustmentΒΆexception libtmux.exc.WindowAdjustmentDirectionRequiresAdjustmentΒΆ
Bases:
WindowError,AdjustmentDirectionRequiresAdjustmentValueError for
libtmux.Window.resize_window().
-
exception libtmux.exc.PaneAdjustmentDirectionRequiresAdjustmentΒΆexception libtmux.exc.PaneAdjustmentDirectionRequiresAdjustmentΒΆ
Bases:
WindowError,AdjustmentDirectionRequiresAdjustmentValueError for
libtmux.Pane.resize_pane().
-
exception libtmux.exc.RequiresDigitOrPercentageΒΆexception libtmux.exc.RequiresDigitOrPercentageΒΆ
Bases:
LibTmuxException,ValueErrorRequires digit (int or str digit) or a percentage.