def save_traceback(app):
 import platform
 exc = traceback.format_exc()
 (fd, path) = tempfile.mkstemp('.log', 'sphinx-err-')
 os.write(fd, (_DEBUG_HEADER % (sphinx.__version__, platform.python_version(), docutils.__version__, docutils.__version_details__, jinja2.__version__)).encode('utf-8'))
 if (app is not None):
  for (extname, extmod) in app._extensions.iteritems():
   os.write(fd, ('#   %s from %s\n' % (extname, getattr(extmod, '__file__', 'unknown'))).encode('utf-8'))
 os.write(fd, exc.encode('utf-8'))
 os.close(fd)
 return path

def save_traceback ( app ) : import platform exc = traceback . format_exc ( ) ( fd , path ) = tempfile . mkstemp ( '.log' , 'sphinx-err-' ) os . write ( fd , ( _DEBUG_HEADER % ( sphinx . __version__ , platform . python_version ( ) , docutils . __version__ , docutils . __version_details__ , jinja2 . __version__ ) ) . encode ( 'utf-8' ) ) if ( app is not None ) : for ( extname , extmod ) in app . _extensions . iteritems ( ) : os . write ( fd , ( '#   %s from %s\n' % ( extname , getattr ( extmod , '__file__' , 'unknown' ) ) ) . encode ( 'utf-8' ) ) os . write ( fd , exc . encode ( 'utf-8' ) ) os . close ( fd ) return path
save the current exceptions traceback in a temporary file .