def rwinput(prompt): while 1: try: return utf8(raw_input(prompt)) except KeyboardInterrupt: print continue break
def _set_password(self, line, prompt1=None, prompt2=None): prompt1 = prompt1 or "Enter the password: "******"Confirm the password: "******"This command accept at least 1 argument" return from getpass import getpass pass1, pass2 = "1", "2" while not pass1.strip() or pass1 != pass2: try: pass1 = getpass(prompt1) except EOFError: print if prompt2 == -1: pass2 = pass1 continue try: pass2 = getpass(prompt2) except EOFError: print return item, utf8(pass1)