def handle_exception(self, exception): """Print a formatted error message if the exception is a BlotishError else print a traceback. Does not cause the interpreter to quit.""" self._error_flag = True if exception.__class__ is blotish.BlotishError: blot_common.print_blot_error(exception) else: traceback.print_exc(file=sys.stdout)
def start(data_file, script_file=None): """Start the pvblot interpreter.""" # Try to start up the interpreter try: initialize(data_file) except blotish.BlotishError, err: blot_common.print_blot_error(err) return
def do_help(self, command_name): """The given argument is a string representing a command name. The string may be empty. Prints documentation for the command name if given else prints a list of available command names.""" if not command_name: print _PVBlotInterp.__doc__ print "The following commands are supported:" print " ", blotish_commands = self._blotish_commands.keys() blotish_commands.sort() for c in blotish_commands: print c, print print print "For more information on any command, try help <command>." return try: command = self.get_unique_command(command_name) print command.__doc__ except blotish.BlotishError, err: blot_common.print_blot_error(err)