First time here? Check out the Help page!

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 2 years ago

sz1980's avatar

updated 1 year ago

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

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 1 year ago

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.

Preview: (hide)
link

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: 2 years ago

Seen: 146 times

Last updated: May 28 '23