Skip to content

Add Improved debugging for the EnSight native Python API #280

@randallfrank

Description

@randallfrank

📝 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions