impure functionexchange

Function that communicates with Python

Information

This function exchanges data with Python. See Buildings.Utilities.IO.Python_3_12.UsersGuide for instructions, and Buildings.Utilities.IO.Python_3_12.Functions.Examples for examples.

Inputs

TypeNameDefaultDescription
StringmoduleNameName of the python module that contains the function
StringfunctionNamemoduleNameName of the python function
BaseClasses.PythonObjectpytObjMemory that holds the Python object
BooleanpassPythonObjectSet to true if the Python function returns and receives an object, see User's Guide
StringpythonPathValue of PYTHONPATH environment variable
Real[max(1, nDblWri)]dblWriDouble values to write
Integer[max(1, nIntWri)]intWriInteger values to write
String[max(1, nStrWri)]strWriString values to write
IntegernDblWriNumber of double values to write
IntegernDblReaNumber of double values to read
IntegernIntWriNumber of integer values to write
IntegernIntReaNumber of integer values to read
IntegernStrWriNumber of strings to write

Outputs

TypeNameDefaultDescription
Real[max(1, nDblRea)]dblReaDouble values returned by Python
Integer[max(1, nIntRea)]intReaInteger values returned by Python

Revisions

  • September 19, 2025, by Michael Wetter:
    Updated to Python 3.12.
  • September 15, 2025, by Michael Wetter:
    Added missing header file.
    This is for issue 4343.
  • August 27, 2021, by Michael Wetter:
    Updated to Python 3.8.
  • April 10, 2020, by Jianjun Hu and Michael Wetter:
    Updated to Python 3.6.
  • March 06, 2020, by Jianjun Hu:
    Upgraded python version from 2.7 to 3.6.
    This is for issue 1760.
  • April 13, 2018, by Michael Wetter:
    Corrected LibraryDirectory annotation.
    This is for issue 1160.
  • March 27, 2013, by Thierry S. Nouidui:
    Added a wrapper to ModelicaFormatError to support Windows OS.
  • January 31, 2013, by Michael Wetter:
    First implementation.