You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The EnSight native Python API uses return codes to report errors. There exists a mechanism (sendmesgoptions) to make those calls throw exceptions instead. The problem with sendmesgoptions is that one cannot leave EnSight in that mode or the GUI/other aspects of EnSight will become non-responsive. The correct use of the function is in a try: finally: clause.
PyEnSight wraps these functions at a higher level and can control this behavior more succinctly. The proposal here is that the Session object have a flag that turns on "native_errors_as_exceptions" just for the native API calls. This would make IDE-based debugging of EnSight scripts much simpler and catch hidden errors.
One question is if the Launcher base class should support the flag as well as 'start()' is the most common way to get a Session instance.
💡 Steps for implementing the feature
Add a property to enable/disable the feature on the Session object (in repr as well???).
Modify the codegen core or the Session interface to ideally leverage the exception keyword on native API calls or wrap in sendmesg.
Potentially add the flag to the Launcher class
📝 Description of the feature
The EnSight native Python API uses return codes to report errors. There exists a mechanism (sendmesgoptions) to make those calls throw exceptions instead. The problem with sendmesgoptions is that one cannot leave EnSight in that mode or the GUI/other aspects of EnSight will become non-responsive. The correct use of the function is in a try: finally: clause.
PyEnSight wraps these functions at a higher level and can control this behavior more succinctly. The proposal here is that the Session object have a flag that turns on "native_errors_as_exceptions" just for the native API calls. This would make IDE-based debugging of EnSight scripts much simpler and catch hidden errors.
One question is if the Launcher base class should support the flag as well as 'start()' is the most common way to get a Session instance.
💡 Steps for implementing the feature
Add a property to enable/disable the feature on the Session object (in repr as well???).
Modify the codegen core or the Session interface to ideally leverage the exception keyword on native API calls or wrap in sendmesg.
Potentially add the flag to the Launcher class
🔗 Useful links and references
https://ensight.docs.pyansys.com/version/dev/_autosummary/ansys.api.pyensight.ensight_api.ensight.sendmesgoptions.html#sendmesgoptions
Note, the above is waiting for a nightly docs build, but should have more information soon.
The text was updated successfully, but these errors were encountered: