errors

ErrorObserver

class PVGeo._helpers.errors.ErrorObserver[source]

Bases: object

A class for catching errors when processing on a VTK pipeline. The AlgorithmBase class handles setting up this observer on initialization.

Example

>>> import PVGeo
>>> # Only use this observer on sub classes of the AlgorithmBase:
>>> f = PVGeo.AlgorithmBase()
>>> f.Update()
>>> if f.error_occurred():
>>>    print(f.get_error_message())
ERROR: ...
error_occurred()[source]

Ask self if an error has occurred

get_error_message(etc=False)[source]

Get the last set error message

Returns

the last set error message

Return type

str

make_observer(algorithm)[source]

Make this an observer of an algorithm

HiddenPrints

class PVGeo._helpers.errors.HiddenPrints[source]

Bases: object

Use this object to hide print statements when performing a task. This is used to suppress printed warnings from discretize on import:

Example: >>> with HiddenPrints(): … import discretize

PVGeoError

class PVGeo._helpers.errors.PVGeoError(message)[source]

Bases: Exception

This is a custom error class for handling errors when processing on the VTK pipeline. It makes the error messages easy to decipher in ParaView and cleans the messages when used in Python outside of ParaView. When on the VTK pipeline, errors aren’t really raised but passed over and printed to the console. This class makes decipher the error streams a whole lot easier for human eyes.

QUALIFIER_L = '@@@@PVGeoError ---> '
QUALIFIER_R = ' <--- PVGeoError@@@@'
SEARCHER = re.compile('@@@@PVGeoError --->.+?<--- PVGeoError@@@@', re.MULTILINE|re.DOTALL)
static clean_message(message)[source]