Exceptions

CanError

exception canlib.canlib.CanError[source]

Bases: canlib.exceptions.DllException

Base class for exceptions raised by the canlib class

Looks up the error text in the canlib dll and presents it together with the error code and the wrapper function that triggered the exception.

CanNoMsg

exception canlib.canlib.CanNoMsg[source]

Bases: canlib.canlib.exceptions.CanError

Raised when no matching message was available

status = -2

CanNotFound

exception canlib.canlib.CanNotFound[source]

Bases: canlib.canlib.exceptions.CanError

Specified device or channel not found

There is no hardware available that matches the given search criteria. For example, you may have specified Open.REQUIRE_EXTENDED but there’s no controller capable of extended CAN. You may have specified a channel number that is out of the range for the hardware in question. You may have requested exclusive access to a channel, but the channel is already occupied.

New in version 1.6.

status = -3

CanScriptFail

exception canlib.canlib.CanScriptFail[source]

Bases: canlib.canlib.exceptions.CanError

Raised when a script call failed.

This exception represents several different failures, for example:

  • Trying to load a corrupt file or not a .txe file

  • Trying to start a t script that has not been loaded

  • Trying to load a t script compiled with the wrong version of the t compiler

  • Trying to unload a t script that has not been stopped

  • Trying to use an envvar that does not exist

status = -39

EnvvarException

exception canlib.canlib.EnvvarException[source]

Bases: canlib.exceptions.CanlibException

Base class for exceptions related to environment variables.

EnvvarNameError

exception canlib.canlib.EnvvarNameError(envvar)[source]

Bases: canlib.canlib.exceptions.EnvvarException

Raised when the name of the environment variable is illegal.

EnvvarValueError

exception canlib.canlib.EnvvarValueError(envvar, type_, value)[source]

Bases: canlib.canlib.exceptions.EnvvarException

Raised when the type of the value does not match the type of the environment variable.

IoNoValidConfiguration

exception canlib.canlib.IoNoValidConfiguration[source]

Bases: canlib.canlib.exceptions.CanError

I/O pin configuration is invalid

No I/O pins was found, or unknown I/O pins was discovered.

New in version 1.8.

status = -48

IoPinConfigurationNotConfirmed

exception canlib.canlib.IoPinConfigurationNotConfirmed[source]

Bases: canlib.canlib.exceptions.CanError

I/O pin configuration is not confirmed

Before accessing any I/O pin value, the device I/O pin configuration must be confirmed, using e.g. Channel.io_confirm_config.

See also iopin.Configuration.

New in version 1.8.

status = -45

TxeFileIsEncrypted

exception canlib.canlib.TxeFileIsEncrypted[source]

Bases: canlib.exceptions.CanlibException

Raised when trying to access Txe.source and the source and byte-code sections of the .txe binary have been encrypted.

New in version 1.6.