inpRWErrors

Module Contents

The inpRWErrors module contains the custom exception types used throughout inpRW.

exception inpRWErrors.inpRWErrors(args=None)

Bases: Exception

The base class for all custom Exception types used by inpRW.

__init__(args=None)

Initializes the exception. args should be a tuple.

inpRWErrors is meant to be subclassed, not used directly. It provides a common base class for the other exceptions in this module.

Example usage:

>>> from inpRWErrors import inpRWErrors
>>> raise inpRWErrors
Traceback (most recent call last):
    ...
inpRWErrors.inpRWErrors: None
Parameters:

args (tuple) – A tuple of arguments which will be passed to the class.

__str__()

Creates a string error message of the object using the default Exception __str__().

__weakref__

list of weak references to the object (if defined)

exception inpRWErrors.KeywordNotFoundError(args=None)

Bases: inpRWErrors

This class is a blank Exception and is raised by findKeyword() to break out of loops if the particular keyword cannot be found in keywords.

Example

>>> from inpRWErrors import KeywordNotFoundError
>>> raise KeywordNotFoundError
Traceback (most recent call last):
    ...
inpRWErrors.KeywordNotFoundError: None
exception inpRWErrors.DecimalInfError(args=None)

Bases: inpRWErrors

This class is a blank Exception and is raised by __new__() if the input string is ‘INF’.

Example

>>> from inpRWErrors import DecimalInfError
>>> raise KeywordNotFoundError
Traceback (most recent call last):
    ...
inpRWErrors.KeywordNotFoundError: None
__str__()

Creates a string error message of the object using the default Exception __str__().

exception inpRWErrors.ElementIncorrectNodeNumError(elementType, nodeNum)

Bases: inpRWErrors

Raised when an element has been assigned the incorrect number of nodes for its element type.

__init__(elementType, nodeNum)

Sets the arguments which will be used in the Error message.

Example

>>> from inpRWErrors import ElementIncorrectNodeNumError
>>> raise ElementIncorrectNodeNumError('C3D8', 8)
Traceback (most recent call last):
    ...
inpRWErrors.ElementIncorrectNodeNumError: ERROR! An element of type C3D8 must have 8 nodes.

If this exception is raised without the proper arguments, a TypeError will instead be raised:

>>> raise ElementIncorrectNodeNumError 
Traceback (most recent call last):
    ...
TypeError: ...__init__() missing 2 required positional arguments: 'elementType' and 'nodeNum'
Parameters:
  • elementType (str) –

  • nodeNum (int) –

__str__()

Produces the string error message.

exception inpRWErrors.ElementTypeMismatchError(otherEltype, meshElementType)

Bases: inpRWErrors

Raised when an Element is inserted into a MeshElement class, and eltype parameter does not match eltype parameter.

__init__(otherEltype, meshElementType)

Sets the arguments which will be used in the Error message.

Example:

>>> from inpRWErrors import ElementTypeMismatchError
>>> raise ElementTypeMismatchError('C3D8R', 'C3D8')
Traceback (most recent call last):
    ...
inpRWErrors.ElementTypeMismatchError: ERROR! An element of type C3D8R cannot be added to a MeshElement with eltype C3D8

If this exception is raised without the proper arguments, a TypeError will instead be raised:

>>> raise ElementTypeMismatchError 
Traceback (most recent call last):
    ...
TypeError: ...__init__() missing 2 required positional arguments: 'otherEltype' and 'meshElementType'
Parameters:
  • otherEltype (str) –

  • meshElementType (str) –

__str__()

Produces the string error message.