We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have a python script which raises exception. How do I print this in the rust log?
The text was updated successfully, but these errors were encountered:
I'm afraid that there's no good API to format the exception as a Rust string at the moment.
In PyO3 0.12 I hope that you'll just be able to write something like:
0.12
log::error!("A Python exception occurred: {}", e.display())
or something very similar to this.
Sorry, something went wrong.
Thanks @davidhewitt appreciate your quick response and looking forward to display() function.
In meantime, any other work around? I am even open to using eval() to retrieve from python module
I think the best you might be able to do is something like
e.restore(py); let s: String = py.eval(r#" import traceback traceback.format_exception() "#)?.extract(py)?; let _ = PyErr::fetch(); log::error!("{}", s);
I've typed this out on my phone, so might have errors.
Successfully merging a pull request may close this issue.
I have a python script which raises exception. How do I print this in the rust log?
The text was updated successfully, but these errors were encountered: