Question

What is the Python API equivalent of PyErr_Print(), from the C interface?

I'm assuming a call in either the sys, or traceback modules, but can't find any functions therein that make calls to PyErr_Print().

Addendum

I'm after the Python call to get the same functionality as PyErr_PrintEx(), described as:

Print a standard traceback to sys.stderr and clear the error indicator.

That is I want to make the Python call that has this effect.

Was it helpful?

Solution

There's no Python function that's exactly equivalent to PyErr_PrintEx (the real name of PyErr_Print;-), including for example setting sys.last_traceback and friends (which are only supposed to be set to help a post-mortem debugging from the interactive interpreter for exceptions which have not been caught). What exact combination of functionality are you looking for?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top