return 1 elif c[0] in ('-h', '--help'): self.help() elif c[0] in ('-j', '--jdir'): self.setJSdir(c[1]) else: return 0 return 1 def run(self): if self.args: file = self.args[0] else: file = sys.stdin if self.jsdir is None: self.setJSdir("default") self.getJSfiles() self.generator.parse(file) self.generator.generate(self.jstext) return app = App(sys.argv) app.parseArgs() app.run()
f = getattr(self.plugin, 'post') f() # If not, don't worry about it. except AttributeError: pass # If it does exist, but something else goes wrong # complain to the admin about it. except: sys.stderr.write("Could not complete 'post()' " +\ "for %s\n" % file) sys.stderr.write("%s: %s\n" \ % (sys.exc_info()[0], sys.exc_info()[1])) except ValueError: raise # Thrown by connect() called by get(). sys.stderr.write("Error: I have no master servers, " "check %s.\n" % (self.config.getFile())) sys.exit(-1) except Error411, msg: sys.stderr.write("Error: %s\n" % msg) sys.exit(-1) # # My Main # app = App(sys.argv) app.parseArgs('four11get') app.run()
return if self.doPublicMode: self.insertor.runPublicOnly() else: self.insertor.run() self.cleanup() class RCFileHandler(rocks.sql.RCFileHandler): def __init__(self, app): rocks.sql.RCFileHandler.__init__(self, app) def startElement_nameserver(self, name, attrs): ns = attrs.get('name') app = App(sys.argv) app.parseArgs() try: app.run() except Exception, msg: app.cleanup() if app.insertor and app.insertor.screen: app.insertor.endGUI() sys.stderr.write('error - ' + str(msg) + '\n') import traceback traceback.print_exc() sys.exit(1)