-
Notifications
You must be signed in to change notification settings - Fork 899
Labels
Milestone
Description
The print method on PyErr (https://pyo3.rs/master/doc/pyo3/struct.PyErr.html#method.print) is super handy but relies on stderr being available on the python side. When embedding rust + python into another application this is not always available and so it fails silently. It would be better if we had a way of getting the string of the error or the traceback as a string in rust, so that we can use it with whatever logging/error infrastructure is already set up on the rust side (eg log!, the failure crate, etc)
At the moment I've been doing some variation of py.eval("str(err)") or py.eval(import traceback; # etc) which works, but is cumbersome.
CptCrispyCrunchy, Patuti, 1tgr and Equim-chan