[Pythonmac-SIG] Problems in Python 2.1b1 Classic with telnetlib and getpass [corrected, please, ignore my previous message]
Alfonso Baciero
alczj@yahoo.es
Tue, 20 Mar 2001 11:12:01 +0100 (CET)
I have installed Python 2.1b1 Classic, and I have had
problems with Python modules getpass and telnetlib:
With getpass, the simple program:
#### gp.py
import getpass
passwd=getpass.getpass('password: ')
#### end of gp.py
didn´t work, with the next error messages:
macintosh hd:aplicaciones:python
2.1b1:lib:termios.py:7: DeprecationWarning: the
TERMIOS module is deprecated; please use termios
DeprecationWarning)
Traceback (most recent call last):
File "Macintosh HD:Desktop Folder:python:gp.py",
line 2, in ?
passwd=getpass.getpass('password: ')
File "macintosh hd:aplicaciones:python
2.1b1:lib:getpass.py", line 30, in unix_getpass
old = termios.tcgetattr(fd) # a copy to save
AttributeError: 'termios' module has no attribute
'tcgetattr'
For telnetlib I ran the next program:
#### ls.py
import telnetlib
host=raw_input('host: ')
tn = telnetlib.Telnet(host)
userid=raw_input('login: ')
tn.read_until("login: ")
tn.write(userid + "\n")
tn.read_until("Password:")
passwd=raw_input('password: ')
tn.write(passwd + "\n")
tn.write("ls -l \n")
tn.write('exit\n')
buf=tn.read_all()
#### end of ls.py
and sometimes it worked, but sometimes, it didn´t
work. The program input/output when there was an error
was:
host: myhost
login: mylogin
password: mypassword
Traceback (most recent call last):
File "Macintosh HD:Desktop Folder:python:ls.py",
line 15, in ?
buf=tn.read_all()
File "macintosh hd:aplicaciones:python
2.1b1:lib:telnetlib.py", line 231, in read_all
self.fill_rawq()
File "macintosh hd:aplicaciones:python
2.1b1:lib:telnetlib.py", line 370, in fill_rawq
buf = self.sock.recv(50)
socket.error: (57, 'Socket is not connected')
Both programs work fine with Python 1.5.2c1 for Mac
and BeOpen-Python 2.0 for Linux,
Alfonso.
_______________________________________________________________
Do You Yahoo!?
Envía mensajes instantáneos y recibe alertas de correo con
Yahoo! Messenger - http://messenger.yahoo.es