OpenWaterAnalytics/EPyT

Unable to catch warnings

Closed this issue · 1 comments

For automated error handling, it is good to catch warnings instead of just having them printed.

However, this is currently impossible to implement because of warnings.simplefilter('always') in line 516. I suggest removing this statement so that the user can decide how to handle warnings -- the default in Python is to print warnings, so there is no need for the statement in line 516.

Let me know what you think.

Hi @andreArtelt,

Thanks for the issues.

d = epanet('net2-cl2.inp', display_warnings=False)  # next version 1.2.0
d.getNodeIndex('wrongid')
print(d.api.errcode)

Users can check the d.api.errcode for the errcodes. We could return the errcode in functions.