Exceptions

exception paramiko.ssh_exception.AuthenticationException

Exception raised when authentication failed for some reason. It may be possible to retry with different credentials. (Other classes specify more specific reasons.)

New in version 1.6.

exception paramiko.ssh_exception.BadAuthenticationType(explanation, types)

Exception raised when an authentication type (like password) is used, but the server isn’t allowing that type. (It may only allow public-key, for example.)

New in version 1.1.

__init__(explanation, types)
__str__()

Return str(self).

exception paramiko.ssh_exception.BadHostKeyException(hostname, got_key, expected_key)

The host key given by the SSH server did not match what we were expecting.

Parameters
  • hostname (str) – the hostname of the SSH server

  • got_key (PKey) – the host key presented by the server

  • expected_key (PKey) – the host key expected

New in version 1.6.

__init__(hostname, got_key, expected_key)
__str__()

Return str(self).

exception paramiko.ssh_exception.ChannelException(code, text)

Exception raised when an attempt to open a new Channel fails.

Parameters

code (int) – the error code returned by the server

New in version 1.6.

__init__(code, text)
__str__()

Return str(self).

exception paramiko.ssh_exception.ConfigParseError

A fatal error was encountered trying to parse SSH config data.

Typically this means a config file violated the ssh_config specification in a manner that requires exiting immediately, such as not matching key = value syntax or misusing certain Match keywords.

New in version 2.7.

exception paramiko.ssh_exception.CouldNotCanonicalize

Raised when hostname canonicalization fails & fallback is disabled.

New in version 2.7.

exception paramiko.ssh_exception.IncompatiblePeer

A disagreement arose regarding an algorithm required for key exchange.

New in version 2.9.

exception paramiko.ssh_exception.MessageOrderError

Out-of-order protocol messages were received, violating “strict kex” mode.

New in version 3.4.

exception paramiko.ssh_exception.NoValidConnectionsError(errors)

Multiple connection attempts were made and no families succeeded.

This exception class wraps multiple “real” underlying connection errors, all of which represent failed connection attempts. Because these errors are not guaranteed to all be of the same error type (i.e. different errno, socket.error subclass, message, etc) we expose a single unified error message and a None errno so that instances of this class match most normal handling of socket.error objects.

To see the wrapped exception objects, access the errors attribute. errors is a dict whose keys are address tuples (e.g. ('127.0.0.1', 22)) and whose values are the exception encountered trying to connect to that address.

It is implied/assumed that all the errors given to a single instance of this class are from connecting to the same hostname + port (and thus that the differences are in the resolution of the hostname - e.g. IPv4 vs v6).

New in version 1.16.

__init__(errors)
Parameters

errors (dict) – The errors dict to store, as described by class docstring.

__reduce__()

Helper for pickle.

__weakref__

list of weak references to the object (if defined)

exception paramiko.ssh_exception.PartialAuthentication(types)

An internal exception thrown in the case of partial authentication.

__init__(types)
__str__()

Return str(self).

exception paramiko.ssh_exception.PasswordRequiredException

Exception raised when a password is needed to unlock a private key file.

exception paramiko.ssh_exception.ProxyCommandFailure(command, error)

The “ProxyCommand” found in the .ssh/config file returned an error.

Parameters
  • command (str) – The command line that is generating this exception.

  • error (str) – The error captured from the proxy command output.

__init__(command, error)
__str__()

Return str(self).

exception paramiko.ssh_exception.SSHException

Exception raised by failures in SSH2 protocol negotiation or logic errors.

__weakref__

list of weak references to the object (if defined)

exception paramiko.ssh_exception.UnableToAuthenticate