def runReactorWithLogging(config, oldstdout, oldstderr, profiler=None, reactor=None):
 if (reactor is None):
  from twisted.internet import reactor
 try:
  if config['profile']:
   if (profiler is not None):
    profiler.run(reactor)
  elif config['debug']:
   sys.stdout = oldstdout
   sys.stderr = oldstderr
   if (runtime.platformType == 'posix'):
    signal.signal(signal.SIGUSR2, (lambda *args: pdb.set_trace()))
    signal.signal(signal.SIGINT, (lambda *args: pdb.set_trace()))
   fixPdb()
   pdb.runcall(reactor.run)
  else:
   reactor.run()
 except:
  if config['nodaemon']:
   file = oldstdout
  else:
   file = open('TWISTD-CRASH.log', 'a')
  traceback.print_exc(file=file)
  file.flush()

def runReactorWithLogging ( config , oldstdout , oldstderr , profiler = None , reactor = None ) : if ( reactor is None ) : from twisted . internet import reactor try : if config [ 'profile' ] : if ( profiler is not None ) : profiler . run ( reactor ) elif config [ 'debug' ] : sys . stdout = oldstdout sys . stderr = oldstderr if ( runtime . platformType == 'posix' ) : signal . signal ( signal . SIGUSR2 , ( lambda * args : pdb . set_trace ( ) ) ) signal . signal ( signal . SIGINT , ( lambda * args : pdb . set_trace ( ) ) ) fixPdb ( ) pdb . runcall ( reactor . run ) else : reactor . run ( ) except : if config [ 'nodaemon' ] : file = oldstdout else : file = open ( 'TWISTD-CRASH.log' , 'a' ) traceback . print_exc ( file = file ) file . flush ( )
start the reactor .