Status

class nifpga.status.Status(code, code_string, function_name, argument_names, function_args)[source]

Bases: exceptions.BaseException

__init__(code, code_string, function_name, argument_names, function_args)[source]

Base exception class for when an NiFpga function returns a non-zero status.

Parameters:
  • code (int) – e.g. -52000
  • code_string (str) – e.g. ‘MemoryFull’
  • function_name (string) – the function that returned the error or warning status. e.g. ‘NiFpga_ConfigureFifo’
  • argument_names (list) – a list of the names of the arguments to the function. e.g. [“session”, “fifo”, “requested depth”]
  • function_args (tuple) – a tuple of the arguments passed to the function. The order of argument_names should correspond to the order of function_args. e.g. ‘(session, fifo, depth)’
__str__()[source]

Returns the function name, status code, and arguments used. Example:

Error: FifoTimeout (-50400) when calling 'Dummy Function Name' with
arguments:
    session: 0xbeef
    fifo: 0xf1f0L
    data: 0xda7aL
    number of elements: 0x100L
    timeout ms: 0x200L
    elements remaining: 0x300L
    a bogus string argument: 'I am a string'
get_args()[source]

Returns a dictionary of argument names to argument values of the function that caused the exception to be raised.

Returns: arg_dict (dictionary): Converts ctypes args to their actual values instead of the ctypes instance. e.g.

{
"session":0x10000L,
"fifo" : 0x0,
...}
get_function_name()[source]

Returns a string for the functions name,

class nifpga.status.WarningStatus(code, code_string, function_name, argument_names, function_args)[source]

Bases: nifpga.status.Status, exceptions.RuntimeWarning

Base warning class for when an NiFpga function returns a warning (> 0) status.

Useful if trying to catch warning and error status exceptions separately

class nifpga.status.ErrorStatus(code, code_string, function_name, argument_names, function_args)[source]

Bases: nifpga.status.Status, exceptions.RuntimeError

Base Error class for when an NiFpga function returns an error (< 0) status.

Useful if trying to catch warning and error status exceptions separately