[Python-bugs-list] [Bug #110655] getpass.getpass on Windows (PR#349)

noreply@sourceforge.net noreply@sourceforge.net
Wed, 13 Sep 2000 03:23:20 -0700


Bug #110655, was updated on 2000-Jul-31 14:10
Here is a current snapshot of the bug.

Project: Python
Category: None
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Summary: getpass.getpass on Windows (PR#349)

Details: Jitterbug-Id: 349
Submitted-By: ctalley@caci.com
Date: Thu,  8 Jun 2000 15:52:19 -0400 (EDT)
Version: 1.5.2
OS: W95


When using this code, the third line is skipped.  That is, the prompt
appears, but the program doesn't pause to accept input data.  It goes
right to the fourth line and pauses there.  I end up with a null string
for "fromaddr".

username=raw_input('Enter FTP server account username: ')
password=getpass.getpass('Enter FTP server account password: ')
fromaddr=raw_input('Enter your e-mail address: ')
toaddr=raw_input('Enter e-mail address for notification: ')

When using this code, everything works (although echo of the
password isn't suppressed.)

username=raw_input('Enter FTP server account username: ')
password=raw_input('Enter FTP server account password: ')
fromaddr=raw_input('Enter your e-mail address: ')
toaddr=raw_input('Enter e-mail address for notification: ')

The difference between the two code segments is that the first uses
the getpass method on the second line and the second uses raw_input.
What I think is happening is that getpass is leaving some garbage
in a buffer somewhere which is seen by raw_input as data.  raw_input
happily accepts the data and goes to the next line.  I've devised
several workarounds including "flush_input_buffer=raw_input('')"
immediately following the call to getpass.  It's ugly, but it works.

Thanks,
Carl Talley



====================================================================
Audit trail:
Tue Jul 11 08:25:59 2000	guido	moved from incoming to open

Follow-Ups:

Date: 2000-Sep-07 15:04
By: jhylton

Comment:
Please do triage on this bug.
-------------------------------------------------------

Date: 2000-Sep-13 03:23
By: gvanrossum

Comment:
Confirmed with Python 2.0b1 on Win98SE.
The bug does not occur on Linux.
Tim, the getpass code for Windows is different than on Unix, so please have a look!
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=110655&group_id=5470