def begin(): print PROMPT_BANNER line="" imagePath=None while True: line = raw_input("Drawgle>> ") if(line=="endsession" or line=='ends'): break imagePath = commandParser.parse(line,imagePath); print ENDSESSION_BANNER
def beginParsing(filename): #check file exists try: with open(filename, 'r') as f: pass except IOError as e: print "File '" + filename + "'' not found." exit() imagePath = None #start parsing file for line in open(filename, 'r').readlines(): imagePath = commandParser.parse(line, imagePath)
def beginParsing(filename): # check file exists try: with open(filename, "r") as f: pass except IOError as e: print "File '" + filename + "'' not found." exit() imagePath = None # start parsing file for line in open(filename, "r").readlines(): imagePath = commandParser.parse(line, imagePath)
def cmd_addcmd(arg): dupe = True try: eval("cmd_" + arg[0]) except: dupe = False if not dupe: print("addCmd", arg) _str = '' print(len(arg)) for i in range(1, len(arg)): _str += arg[i] + ' ' print("add:" + _str) cmd_list[arg[0]] = commandParser.parse(_str) print(cmd_list[arg[0]])