Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
2

Python API error handling (to stderr)

asked 2023-05-04 06:46:06 -0600

sz1980's avatar

updated 2023-05-24 08:29:16 -0600

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-05-28 05:37:30 -0600

sz1980's avatar

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2023-05-04 06:46:06 -0600

Seen: 112 times

Last updated: May 28 '23