Skip to content

pretty python exception traceback in rust #592

Closed
@jmrgibson

Description

@jmrgibson

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions