MaskFPUExceptions - Embarcadero/python4delphi GitHub Wiki

Masking FPU Exceptions

Delphi raises an exception when floating operations result produce +/- infinity (e.g. division by zero). This setting is not compatible with a number of Python libraries such as numpy and scipy.

Python for Delphi provides a procedure MaskFPUExceptions that can help resolve such issues. If you get errors when using python libraries you make want to take the following statement:

 MaskFPUExceptions(True)

to either the initialization section of any unit or to the OnBeforeLoad event handler of the PythonEngine.

See also How Python for Delphi finds your Python distribution for information about PythonEngine properties that affect the loading of Python.