def cry():
 tmap = {}
 main_thread = None
 for t in threading.enumerate():
  if getattr(t, 'ident', None):
   tmap[t.ident] = t
  else:
   main_thread = t
 out = StringIO()
 sep = (('=' * 49) + '\n')
 for (tid, frame) in sys._current_frames().iteritems():
  thread = tmap.get(tid, main_thread)
  if (not thread):
   continue
  out.write(('%s\n' % (thread.getName(),)))
  out.write(sep)
  traceback.print_stack(frame, file=out)
  out.write(sep)
  out.write('LOCAL VARIABLES\n')
  out.write(sep)
  pprint(frame.f_locals, stream=out)
  out.write('\n\n')
 return out.getvalue()

def cry ( ) : tmap = { } main_thread = None for t in threading . enumerate ( ) : if getattr ( t , 'ident' , None ) : tmap [ t . ident ] = t else : main_thread = t out = StringIO ( ) sep = ( ( '=' * 49 ) + '\n' ) for ( tid , frame ) in sys . _current_frames ( ) . iteritems ( ) : thread = tmap . get ( tid , main_thread ) if ( not thread ) : continue out . write ( ( '%s\n' % ( thread . getName ( ) , ) ) ) out . write ( sep ) traceback . print_stack ( frame , file = out ) out . write ( sep ) out . write ( 'LOCAL VARIABLES\n' ) out . write ( sep ) pprint ( frame . f_locals , stream = out ) out . write ( '\n\n' ) return out . getvalue ( )
return stacktrace of all active threads .