def win_getpass(prompt='Password: ', stream=None):
 if (sys.stdin is not sys.__stdin__):
  return fallback_getpass(prompt, stream)
 import msvcrt
 for c in prompt:
  msvcrt.putch(c)
 pw = ''
 while 1:
  c = msvcrt.getch()
  if ((c == '\r') or (c == '\n')):
   break
  if (c == '\x03'):
   raise KeyboardInterrupt
  if (c == '\x08'):
   pw = pw[:(-1)]
  else:
   pw = (pw + c)
 msvcrt.putch('\r')
 msvcrt.putch('\n')
 return pw

def win_getpass ( prompt = 'Password: ' , stream = None ) : if ( sys . stdin is not sys . __stdin__ ) : return fallback_getpass ( prompt , stream ) import msvcrt for c in prompt : msvcrt . putch ( c ) pw = '' while 1 : c = msvcrt . getch ( ) if ( ( c == '\r' ) or ( c == '\n' ) ) : break if ( c == '\x03' ) : raise KeyboardInterrupt if ( c == '\x08' ) : pw = pw [ : ( - 1 ) ] else : pw = ( pw + c ) msvcrt . putch ( '\r' ) msvcrt . putch ( '\n' ) return pw
prompt for password with echo off .