Author mnewman
Recipients mnewman
Date 2010-01-23.02:14:56
SpamBayes Score 1.14908e-14
Marked as misclassified No
Message-id <1264212900.62.0.226780855818.issue7761@psf.upfronthosting.co.za>
In-reply-to
Content
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@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:
History
Date User Action Args
2010-01-23 02:15:01mnewmansetrecipients: + mnewman
2010-01-23 02:15:00mnewmansetmessageid: <1264212900.62.0.226780855818.issue7761@psf.upfronthosting.co.za>
2010-01-23 02:14:58mnewmanlinkissue7761 messages
2010-01-23 02:14:56mnewmancreate