2

Python API error handling (to stderr)

Hi,

I am working with the Python API 0.2 and EnergyPlus 22.1.0.

I need to do some value checking (if values are finite) inside of my callback functions. What I noticed is, that (a) ValueErrors in Python code do not get recognized during a run (nor after one), (2) the stderr does not print them either, and (3) the api.runtime.issue_severe() does not stop EnergyPlus or prints the error message to stderr.

Is there any way to let EnergyPlus in case of a Python error stop and print the error to the stderr or as an alternative, let Python stop EnergyPlus?

Thanks for any help here

sz1980's avatar
41
sz1980
asked 2023-05-04 06:46:06 -0500, updated 2023-05-24 08:29:16 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

This has been answered in the related GitHub issue. In v23.2. there will be a stop_energyplus() method in the Runtime API that stops EnergyPlus runs gracefully.

The issue_severe() could then be used to indicate in EnergyPlus error reports why the run was aborted and an error can be raised in Python in the usual form. I think this is a great solution.

sz1980's avatar
41
sz1980
answered 2023-05-28 05:37:30 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments