[New-bugs-announce] [issue10695] telnetlib.Telnet port number int/str inconsistency

Christian S. Perone report at bugs.python.org
Mon Dec 13 20:27:09 CET 2010

New submission from Christian S. Perone <christian.perone at gmail.com>:

When you use telnetlib with a "str" parameter as Port Number:
tel = telnetlib.Telnet("", "8123")
tel.read_until("login: ")

It works fine, except if you set the debuglevel:

Then the follow exception is thrown:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\python26\lib\telnetlib.py", line 306, in read_until
  File "c:\python26\lib\telnetlib.py", line 517, in fill_rawq
    self.msg("recv %r", buf)
  File "c:\python26\lib\telnetlib.py", line 239, in msg
    print 'Telnet(%s,%d):' % (self.host, self.port),
TypeError: %d format: a number is required, not str

I think that the string "Telnet(%s,%d):" on the telnetlib.py should be "Telnet(%s,%s):", since it works fine with a str as Port Number.

components: Library (Lib)
messages: 123894
nosy: Christian.S..Perone
priority: normal
severity: normal
status: open
title: telnetlib.Telnet port number int/str inconsistency
type: behavior
versions: Python 2.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list