# ICE Revision: $Id$ """Standardized Error Messages""" import traceback import sys from PyFoam.Basics.TerminalFormatter import TerminalFormatter from PyFoam.ThirdParty.six import print_ defaultFormat=TerminalFormatter() defaultFormat.getConfigFormat("error") defaultFormat.getConfigFormat("warning",shortName="warn") def getLine(up=0): try: # just get a few frames f = traceback.extract_stack(limit=up+2) if f: return f[0] except: if __debug__: traceback.print_exc() pass return ('', 0, '', None) def isatty(s): """Workaround for outputstreams that don't implement isatty (specifically vtkPythonStdStreamCaptureHelper) """ try: return s.isatty except AttributeError:
# ICE Revision: $Id$ """Base class for pyFoam-applications Classes can also be called with a command-line string""" from optparse import OptionGroup from PyFoam.Basics.FoamOptionParser import FoamOptionParser, SubcommandFoamOptionParser from PyFoam.Error import error, warning, FatalErrorPyFoamException, PyFoamException, isatty from PyFoam.RunDictionary.SolutionDirectory import NoTouchSolutionDirectory from PyFoam.Basics.TerminalFormatter import TerminalFormatter from PyFoam import configuration format = TerminalFormatter() format.getConfigFormat("error") format.getConfigFormat("warn") import sys from os import path, getcwd, environ from copy import deepcopy from PyFoam.ThirdParty.six import print_ from PyFoam.ThirdParty.six import iteritems class PyFoamApplicationException(FatalErrorPyFoamException): def __init__(self, app, *text): self.app = app FatalErrorPyFoamException.__init__(self, *text) def __str__(self):