def init(): try: pygame.mixer.init(MIXER_FREQUENCY) except: print "Failed to initialize sound system" import debug print debug.get_traceback()
def run_archy(): process_command_line_arguments() import debug debug_log = debug.DebugLog('log/debug.log') debug_log.install() import time print "---- Archy session started %s ----" % time.ctime() print debug.get_system_info() init_fundamentals() try: main() except SystemExit: # Archy exited gracefully. shutdownServiceThreads() except: print "---- Abnormal Archy termination ----" # Archy exited abnormally. shutdownServiceThreads() # TODO: We might want to implement a more "graceful" abnormal exit, such as informing the user that a fatal error occurred. import debug tb_info = debug.get_traceback() print tb_info debug.report_bug("Abnormal Archy termination", tb_info) import platform_specific platform_specific.shutdown_hook() print "---- Archy session ended %s ----" % time.ctime() debug_log.uninstall()
def run_archy(): process_command_line_arguments() import debug debug_log = debug.DebugLog('debug.log') debug_log.install() import time print "---- Archy session started %s ----" % time.ctime() print debug.get_system_info() init_fundamentals() try: main() except SystemExit: # Archy exited gracefully. shutdownServiceThreads() except: print "---- Abnormal Archy termination ----" # Archy exited abnormally. shutdownServiceThreads() # TODO: We might want to implement a more "graceful" abnormal exit, such as informing the user that a fatal error occurred. import debug tb_info = debug.get_traceback() print tb_info debug.report_bug("Abnormal Archy termination", tb_info) import platform_specific platform_specific.shutdown_hook() print "---- Archy session ended %s ----" % time.ctime() debug_log.uninstall()
try: archyState.commandHistory.executeCommand(command) if clearDisplay: messages.hide() except SystemExit: raise except commands.AbortCommandException, e: messages.hide() messages.queue("%s: %s" % (command.name(), e.getExplanation())) messages.display() except: import debug error_name = "Command %s did not run properly." % command.name() print error_name tb_info = debug.get_traceback() debug.report_bug(error_name, tb_info) messages.hide() messages.queue(error_name) messages.display() def runCommand(self, command): commands.save_and_load.saveChanges() self._executeCommand(command, clearDisplay=1) archyState.commandHistory.setLastCommand(command) def runLastCommand(self): lastCommand = archyState.commandHistory.getLastCommand() if lastCommand == None: return