Issues with getpass()

rawkawawka jmaris at ea.com
Thu Apr 26 14:21:56 EDT 2001


I was messing around with the sample that is included in the official
python reference to telnetlib.

Whenever I run the sample (included below), it gets hung up on
getpass() .. pythonwin freezes and I have to task slam it.

I set up a breakpoint on the getpass line and stepped thru the
resulting module code.

The module detects my terminal fine (win98SE) but it gets stuck in
this loop (from getpass module):

while 1:
        c = msvcrt.getch()
        if c == '\r' or c == '\n':
            break
        if c == '\003':
            raise KeyboardInterrupt
        if c == '\b':
            pw = pw[:-1]
        else:
            pw = pw + c

If I try to step over this, my app freezes.

Anyhoot, can anyone help me with this? I am a durn fool idgit when it
comes to windows, wine, and women.

Thank you.

***

Telnetlib sample:

import getpass
import sys
import telnetlib

HOST = "vdev03.kesmai.com"
user = raw_input("Enter your remote account: ")
password = getpass.getpass()

tn = telnetlib.Telnet(HOST)

tn.read_until("login: ")
tn.write(user + "\n")
if password:
    tn.read_until("Password: ")
    tn.write(password + "\n")

tn.write("ls\n")
tn.write("exit\n")

print tn.read_all()



More information about the Python-list mailing list