def paste_traceback(exc_type, exc, tb):
"""
This is a traceback handler that knows how to paste to the pastebin.
Should only be used in sys.excepthook.
"""
sys.__excepthook__(exc_type, exc, tb)
from yt.extern.six.moves import StringIO, xmlrpc_client
p = xmlrpc_client.ServerProxy(
"http://paste.yt-project.org/xmlrpc/",
allow_none=True)
s = StringIO()
traceback.print_exception(exc_type, exc, tb, file=s)
s = s.getvalue()
ret = p.pastes.newPaste('pytb', s, None, '', '', True)
print()
print("Traceback pasted to http://paste.yt-project.org/show/%s" % (ret))
print()
评论列表
文章目录