def traceback_thread(thread_id):
 if (not hasattr(sys, '_current_frames')):
  return None
 frames = sys._current_frames()
 if (not (thread_id in frames)):
  return None
 frame = frames[thread_id]
 out = StringIO()
 traceback.print_stack(frame, file=out)
 return out.getvalue()

def traceback_thread ( thread_id ) : if ( not hasattr ( sys , '_current_frames' ) ) : return None frames = sys . _current_frames ( ) if ( not ( thread_id in frames ) ) : return None frame = frames [ thread_id ] out = StringIO ( ) traceback . print_stack ( frame , file = out ) return out . getvalue ( )
returns a plain-text traceback of the given thread .