[New-bugs-announce] [issue7761] telnetlib Telnet.interact fails on Windows but not Linux

Michael Newman report at bugs.python.org
Sat Jan 23 03:15:00 CET 2010


New submission from Michael Newman <michael.b.newman at gmail.com>:

Telnet.interact() is failing on Python 3.1.1 Windows, but works fine on Python 2.6.4 Windows and also works on Python 3.1.1 Linux. See 3 examples below:

--- Test #1 (fails): Telnet.interact on Python 3.1.1 Windows --- 

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from telnetlib import Telnet
>>> tn = Telnet("scn.org", 23)
>>> tn.interact()
Unhandled exception in thread started by <bound method Telnet.listener of <telnetlib.Telnet object at 0x00C3C3F0>>
Traceback (most recent call last):
  File "C:\python31\lib\telnetlib.py", line 566, in listener
    sys.stdout.write(data)
TypeError: must be str, not bytes
# (I press enter again):
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\python31\lib\telnetlib.py", line 528, in interact
    self.mt_interact()
  File "C:\python31\lib\telnetlib.py", line 555, in mt_interact
    self.write(line)
  File "C:\python31\lib\telnetlib.py", line 277, in write
    if IAC in buffer:
TypeError: 'in <string>' requires string as left operand, not bytes

--- Test #2 (works): Telnet.interact on Python 2.6.4 Windows ---

Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from telnetlib import Telnet
>>> tn = Telnet("scn.org", 23)
>>> tn.interact()

Seattle Community Network Sun Solaris 1.1.1.B
Please login as 'visitor' if you are a visitor


SunOS UNIX (scn)

login:

--- Test #3 (works): Telnet.interact on Python 3.1.1 Linux ---

mike at ebx2009:~$ python3.1
Python 3.1.1 (r311:74480, Oct 18 2009, 19:21:53) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from telnetlib import Telnet
>>> tn = Telnet("scn.org", 23)
>>> tn.interact()

Seattle Community Network Sun Solaris 1.1.1.B
Please login as 'visitor' if you are a visitor


SunOS UNIX (scn)

login:

----------
components: Library (Lib), Windows
messages: 98174
nosy: mnewman
severity: normal
status: open
title: telnetlib Telnet.interact fails on Windows but not Linux
versions: Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7761>
_______________________________________


More information about the New-bugs-announce mailing list