Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Improved debugging for the EnSight native Python API #280

Open
randallfrank opened this issue Aug 10, 2023 · 0 comments
Open

Add Improved debugging for the EnSight native Python API #280

randallfrank opened this issue Aug 10, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@randallfrank
Copy link
Collaborator

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

@randallfrank randallfrank added the enhancement New feature or request label Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant