19. API - Exceptions

The following exceptions are defined by Lanner PSP. Please note that multiple inheritance is heavily used in the exception hierarchy to make testing for exceptions easier. For example, to capture any exception generated by Lanner PSP’s code:

from lannerpsp import *

led = LTEStressLED()
try:
    led.set_strength(200)
except PSPError:
    print("A Lanner PSP error occurred")

Since all Lanner PSP’s exceptions descend from PSPError, this will work. However, certain specific errors have multiple parents. For example, in the case that an out of range value is passed to percent you would expect a ValueError to be raised. In fact, a PSPInvalid error will be raised. However, note that this descends from both PSPError (indirectly) and from ValueError so you can still do the obvious:

from lannerpsp import *

led = LTEStressLED()
try:
    led.set_strength(200)
except ValueError:
    print("Bad value specified")

19.1. Errors

exception lannerpsp.PSPError[source]

Bases: Exception

Generic error message (Base class for all exceptions in Lanner PSP)

exception lannerpsp.PSPNotExist[source]

Bases: PSPError, FileNotFoundError

Error raised when library file is not found/plugged, or the device does not exist

exception lannerpsp.PSPNotOpened[source]

Bases: PSPError, RuntimeError

Error raised when library is not opened or not ready yet

exception lannerpsp.PSPInvalid[source]

Bases: PSPError, ValueError

Error raised when the Parameter is not a valid value or out of range

exception lannerpsp.PSPNotSupport[source]

Bases: PSPError, RuntimeError

Error raised when this function is not supported in this platform

exception lannerpsp.PSPBusyInUses[source]

Bases: PSPError, RuntimeError

Error raised when library is being used now or device IO is busy now

exception lannerpsp.PSPBoardNotMatch[source]

Bases: PSPError, RuntimeError

Error raised when the board library and the board do not match

exception lannerpsp.PSPDriverNotLoad[source]

Bases: PSPError, RuntimeError

Error raised when the lmbiodrv driver or i2c-dev driver not loading

exception lannerpsp.IPMIError[source]

Bases: PSPError

Base class for errors related to the IPMI implementation

exception lannerpsp.IPMIIdleState[source]

Bases: IPMIError, RuntimeError

Error raised when IPMI KCS interface is not in IDLE State

exception lannerpsp.IPMIWriteState[source]

Bases: IPMIError, RuntimeError

Error raised when IPMI KCS interface WRITE State check failure

exception lannerpsp.IPMIReadState[source]

Bases: IPMIError, RuntimeError

Error raised when IPMI KCS interface READ State check failure

exception lannerpsp.IPMIIBF0[source]

Bases: IPMIError, RuntimeError

Error raised when IPMI KCS interface wait IBF ‘0’ State failure

exception lannerpsp.IPMIOBF1[source]

Bases: IPMIError, RuntimeError

Error raised when IPMI KCS interface wait OBF ‘1’ State failure

19.2. Warnings

exception lannerpsp.PSPWarning[source]

Bases: Warning

Base class for all warnings in Lanner PSP