Python 相当于 PyErr_Print()
来自 C 接口的 PyErr_Print()
的 Python API 等效项是什么?
我假设在 sys
或 traceback
模块中进行调用,但在其中找不到任何调用 PyErr_Print()
的函数>。
附录
我在Python调用之后获得与PyErr_PrintEx()
相同的功能,描述为:
Print a standard traceback to sys.stderr and clear the error indicator.
那就是我想要进行具有此效果的Python调用。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有与
PyErr_PrintEx
(PyErr_Print
的真实名称;-)完全等效的 Python 函数,包括例如设置sys.last_traceback
和朋友(这些设置应该只是为了帮助交互式解释器对未捕获的异常进行事后调试)。您正在寻找什么样的功能组合?There's no Python function that's exactly equivalent to
PyErr_PrintEx
(the real name ofPyErr_Print
;-), including for example settingsys.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?