[Python-bugs-list] [ python-Bugs-640094 ] on win32 getpass runs into unix_getpass

noreply@sourceforge.net noreply@sourceforge.net
Tue, 19 Nov 2002 17:38:39 -0800


Bugs item #640094, was opened at 2002-11-18 08:54
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=640094&group_id=5470

Category: Windows
Group: Platform-specific
Status: Open
Resolution: Works For Me
Priority: 5
Submitted By: Bajusz Tamás (btami)
>Assigned to: Neal Norwitz (nnorwitz)
Summary: on win32 getpass runs into unix_getpass

Initial Comment:
In python 2.2.2 the getpass module from line 105:

try:
    import termios
except ImportError:
    bla-bla

else:
    getpass = unix_getpass

but import termios doesn't fires ImportError, so
getpass will be unix_gatpass, and later it fails
on AttributeError: 'module' object has no attribute
'tcgetattr'

Why termios.py exist in the win32 packages ?

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2002-11-19 20:38

Message:
Logged In: YES 
user_id=31435

Bajusz:  we ship the same libraries on all platforms.  This is 
important when, e.g., the Python library at a site is shared 
via a network drive.  That won't change.

Neal:  Ya, a hasattr check wouldn't hurt at all, and may 
help.  Feel encouraged to do it!  Assigning to you in the 
hopes that you will.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-11-19 14:01

Message:
Logged In: YES 
user_id=33168

Tim would it be safer (ie, more fullproof, in case a user
has a termios) to also check hasttr(termios, 'tcgetattr')
and/or tcsetattr even if the import succeeds?

Or should this bug report be closed?

----------------------------------------------------------------------

Comment By: Bajusz Tamás (btami)
Date: 2002-11-19 03:43

Message:
Logged In: YES 
user_id=473527

But why TERMIOS.py in the Windows distibution?

----------------------------------------------------------------------

Comment By: Bajusz Tamás (btami)
Date: 2002-11-19 03:41

Message:
Logged In: YES 
user_id=473527

McMillan is evil. When it builds my app (GNUe reports),
it compiles TERMIOS.py into termios.pyc.

Thank anyway.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2002-11-18 11:03

Message:
Logged In: YES 
user_id=31435

Whose distribution of Python are you using?  termios 
doesn't exist in the PLabs Windows distro:

C:\Python22>python
Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more 
information.
>>> import termios
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named termios
>>>

Try running Python with -v to see where termios is coming 
from on your installation.  Perhaps you have a search path 
set strangely, or picked up a termios module from some 
other software.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=640094&group_id=5470