def start(self): self._play_introduction_dialog() while (True): print("\nIt's your turn") print("What do you want to do?") print() command = input().lower() system('clear') CommandLine.parse(command)
def main(): commandline = CommandLine(sys.argv) e = None try: #if True : action = commandline.parse() if action == CommandLine.ACTION_DUMP: configuration = Configuration() dumpername = configuration.get_value('dumper') pluginpath = [] pluginsubpath = os.path.join('dirstat', 'Dumpers') if os.path.exists(sys.argv[0]): pluginpath.append( os.path.join(os.path.dirname(sys.argv[0]), pluginsubpath)) if configuration.get_value('pluginpath') != '': pluginpath.append( os.path.join(configuration.get_value('pluginpath'), pluginsubpath)) pluginpath.append(configuration.get_value('pluginpath')) for pathname in sys.path: pluginpath.append(os.path.join(pathname, pluginsubpath)) try: modulename = dumpername #print (modulename,pluginpath) moduleinfo = imp.find_module(modulename, pluginpath) #print (moduleinfo,) module = imp.load_module(modulename, *moduleinfo) moduleinfo[0].close() Dumper = module.Dumper Dumper().dump() except ImportError: raise ParseError('Dumper %s cannot be loaded' % (dumpername, )) elif action == CommandLine.ACTION_USAGE: print commandline.get_usage() elif action == CommandLine.ACTION_CONFIG: config() except (ParseError, ValueError), e: print commandline.get_usage() raise e
def main() : commandline = CommandLine(sys.argv) e = None try : #if True : action = commandline.parse() if action == CommandLine.ACTION_DUMP : configuration = Configuration() dumpername = configuration.get_value('dumper') pluginpath = [] pluginsubpath = os.path.join('dirstat','Dumpers') if os.path.exists(sys.argv[0]) : pluginpath.append(os.path.join(os.path.dirname(sys.argv[0]),pluginsubpath)) if configuration.get_value('pluginpath') != '' : pluginpath.append(os.path.join(configuration.get_value('pluginpath'),pluginsubpath)) pluginpath.append(configuration.get_value('pluginpath')) for pathname in sys.path : pluginpath.append(os.path.join(pathname,pluginsubpath)) try : modulename = dumpername #print (modulename,pluginpath) moduleinfo = imp.find_module(modulename,pluginpath) #print (moduleinfo,) module = imp.load_module(modulename,*moduleinfo) moduleinfo[0].close() Dumper = module.Dumper Dumper().dump() except ImportError : raise ParseError('Dumper %s cannot be loaded' % (dumpername,)) elif action == CommandLine.ACTION_USAGE : print commandline.get_usage(), elif action == CommandLine.ACTION_VERSION : print commandline.get_version_text(), elif action == CommandLine.ACTION_CONFIG : config() except (ParseError,ValueError), e : print commandline.get_usage() raise e